Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function receives messages intended for the default dialog box procedure of the Fontdialog box. This function is an application-defined callback function that you use with ChooseFont (function).

The LPCFHOOKPROCtype defines a pointer to this callback function. CFHookProcis a placeholder for the application-defined function name.

Syntax

UINT (APIENTRY* LPCFHOOKPROC)(
  HWND 
hdlg,
  UINT 
uiMsg,
  WPARAM 
wParam,
  LPARAM 
lParam
);

Parameters

hdlg

[in] Handle to the Fontdialog box for which the message is intended.

uiMsg

[in] Unsigned integer that identifies the message being received.

wParam

[in] Specifies additional information about the message. The exact meaning depends on the value of the uiMsgparameter.

lParam

[in] Specifies additional information about the message. The exact meaning depends on the value of the uiMsgparameter. If the uiMsgparameter indicates the WM_INITDIALOGmessage, lParamis a pointer to a CHOOSEFONT (structure), which contains the values that the application specified when it created the dialog box.

Return Value

Return zero if you want the default dialog box procedure to process the message. Return a nonzero value if you want the default dialog box procedure to ignore the message.

Remarks

When you use the ChooseFontfunction to create a Fontdialog box, you can provide a CFHookProchook function to process messages intended for the dialog box procedure. To enable the hook function, use the CHOOSEFONTstructure that you passed to ChooseFont. Specify the address of the hook function in the lpfnHookmember of CHOOSEFONTand specify CF_ENABLEHOOK in the Flagsmember.

The default dialog box procedure processes the WM_INITDIALOG message before passing the message to CFHookProc. For all other messages, the hook function receives the message first. The return value of the hook function then determines whether the default dialog box procedure processes or ignores the message.

If CFHookProcprocesses the WM_CTLCOLORDLGmessage, CFHookProcmust return a valid brush handle for painting the background of the dialog box. In general, if the hook function processes any WM_CTLCOLOR* message, the hook function must return a valid brush handle for painting the background of the specified control.

Do not call the EndDialogfunction from CFHookProc. Instead, the hook function can call the PostMessagefunction to post a WM_COMMANDmessage with the IDABORTvalue set to the dialog box procedure. Posting IDABORTcloses the dialog box and causes the dialog box procedure to return FALSE. If you need to know why the hook function closed the dialog box, you must provide your own communication mechanism between the hook function and your application.

You can subclass the standard controls of a common dialog box. The dialog box procedure, however, can also subclass the controls. Therefore, you should subclass controls when your hook function processes the WM_INITDIALOG message. Doing so ensures that your subclass function receives the control-specific messages before the subclass function set by the dialog box procedure.

Requirements

Header commdlg.h
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also