Partager via


CFHookProc (Windows CE 5.0)

Send Feedback

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

The LPCFHOOKPROC type defines a pointer to this callback function. CFHookProc is a placeholder for the application-defined function name.

Syntax

UINT (APIENTRY* LPCFHOOKPROC)(HWND hdlg,UINTuiMsg,WPARAMwParam,LPARAMlParam);

Parameters

  • hdlg
    [in] Handle to the Font dialog 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 uiMsg parameter.
  • lParam
    [in] Specifies additional information about the message. The exact meaning depends on the value of the uiMsg parameter. If the uiMsg parameter indicates the WM_INITDIALOG message, lParam is a pointer to a CHOOSEFONT (structure), which contains the values that the application specified when it created the dialog box.

Return Values

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 ChooseFont function to create a Font dialog box, you can provide a CFHookProc hook function to process messages intended for the dialog box procedure. To enable the hook function, use the CHOOSEFONT structure that you passed to ChooseFont. Specify the address of the hook function in the lpfnHook member of CHOOSEFONT and specify CF_ENABLEHOOK in the Flags member.

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 CFHookProc processes the WM_CTLCOLORDLG message, CFHookProc must 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 EndDialog function from CFHookProc. Instead, the hook function can call the PostMessage function to post a WM_COMMAND message with the IDABORT value set to the dialog box procedure. Posting IDABORT closes 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.

The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT message to the dialog box to retrieve the current values of the dialog box.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Commdlg.h.

See Also

Common Dialog Boxes Functions | ChooseFont (function) | EndDialog | PostMessage | WM_CHOOSEFONT_GETLOGFONT | WM_COMMAND | WM_CTLCOLORDLG | WM_INITDIALOG | CHOOSEFONT (structure)

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.