HOWTO: Create 3D Controls in Client Area of Non-Dialog Window

Last reviewed: March 3, 1998
Article ID: Q130763
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows 95
    

SUMMARY

An application that uses standard Windows controls (edit boxes, list boxes, and so on) as part of a dialog box with the DS_3DLOOK style set, have the 3D look by default. But if an application creates child controls as part of the main window's client area, these controls do not have the 3D look by default. Applications should add the WS_EX_CLIENTEDGE style to the list of styles while creating the child controls to get the new 3D look.

MORE INFORMATION

WS_EX_CLIENTEDGE is the new extended style that gives controls (or any window for that matter) the new 3D look. When controls are created as part of a dialog box by using a dialog template based in the resource file, Windows adds the WS_EX_CLIENTEDGE style to the list of styles.

Some applications use controls as child windows in the client area of the main window. If the WS_EX_CLIENTEDGE style is not specified, these controls have the Windows version 3.11 user interface (2D look).

The WS_EX_CLIENTEDGE style can be set as a style for the control in by using the CreateWindowEx() function to create the control and adding the WS_EX_CLIENTEDGE style to the extended styles specified in by the dwExStyle parameter.

If you are using Microsoft Foundation Classes (MFC), you can add the WS_EX_CLIENTEDGE style to the control by deriving your own class from the control, overriding the PreCreateWindow virtual member function, and adding this style to the extended styles specified in the dwExStyle member of the REATESTUCT structure passed to the PreCreateWindow function.

In both cases make sure you OR in the WS_EX_CLIENTEDGE style with the existing extended styles of the control.

Keywords          : UsrCtl
Technology        : kbMfc
Version           : WIN95
Platform          : Win95
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.