INF: Using a Fixed-Pitch Font in a Dialog Box

ID Number: Q77991

3.00

WINDOWS

Summary:

To use a fixed-pitch font in a dialog box, during the processing of

the dialog box initialization message, send the WM_SETFONT message to

each control that will use the fixed font. The following code

demonstrates this process:

case WM_INITDIALOG:

SendDlgItemMessage(hDlg, ID_CONTROL, WM_SETFONT,

GetStockObject(ANSI_FIXED_FONT), FALSE);

/*

* Note: This code will specify the fixed font only for the

* control ID_CONTROL. To specify the fixed font for other

* controls in the dialog box, additional calls to

* SendDlgItemMessage() are required.

*/

break;

This information is also outlined in Section 1.4.1 of the TIPS.TXT

file, which is included in the Windows Software Development Kit (SDK).

TIPS.TXT is installed into the Windows development directory (by

default, C:\WINDEV).