Using the DS_SETFONT Dialog Box Style

Last reviewed: November 2, 1995
Article ID: Q87344
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) versions 3.1
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
        - Microsoft Windows 95 version 4.0
    

SUMMARY

In the Microsoft Windows graphical environment, an application can affect the appearance of a dialog box by specifying the DS_SETFONT style bit. DS_SETFONT is available only when the application creates a dialog box dynamically from a memory-resident dialog box template using the CreateDialogIndirect, CreateDialogIndirectParam, DialogBoxIndirect, or DialogBoxIndirectParam function. The second parameter to each of these functions is the handle to a global memory object that contains a DLGTEMPLATE dialog box template data structure. The dwStyle (first) member of the DLGTEMPLATE structure contains style information for the dialog box.

When an application creates a dialog box using one of these functions, Windows determines whether the template contains a FONTINFO data structure by checking for the DS_FONTSTYLE bit in the dwStyle member of the DLGTEMPLATE structure. If this bit is set, Windows creates a font for the dialog box and its controls based on the information in the FONTINFO structure. Otherwise, Windows uses the default system font to calculate the size of the dialog box and the placement and text of its controls.

If Windows creates a font based on the FONTINFO data structure, it sends a WM_SETFONT message to the dialog box. If Windows uses the system default font, it does not send a WM_SETFONT message. A dialog box can change the font of one or more of its controls by creating a font and sending a WM_SETFONT message with the font handle to the appropriate controls.


Additional reference words: 3.10 3.50 3.51 4.00 95
KBCategory: kbui
KBSubcategory: UsrDlgs


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: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.