OFNHookProc
An OFNHookProc
hook procedure is an application-defined or library-defined callback procedure
that is used with the Explorer-style Open and Save As common dialog boxes. The
hook procedure receives notification messages sent from the common dialog box.
The hook procedure also receives messages for any additional controls that you
defined by specifying a child dialog template.
If you do not
specify the OFN_EXPLORER flag when you create an Open or Save As common dialog
box, and you want a hook procedure, you must use an old-style OFNHookProcOldStyle
UINT APIENTRY OFNHookProc(
HWND hdlg, |
// handle to child
dialog window |
UINT uiMsg, |
// message
identifier |
WPARAM wParam, |
// message
parameter |
LPARAM lParam |
// message
parameter |
); |
|
Parameters
hdlg
Handle to the
child dialog box of the Open or Save As dialog box. Use the GetParent
uiMsg
Identifies
the message being received.
wParam
Specifies
additional information about the message. The exact meaning depends on the
value of the uiMsg parameter.
lParam
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
Return Values
If the hook
procedure returns zero, the default dialog box procedure processes the message.
If the hook
procedure returns a nonzero value, the default dialog box procedure ignores the
message.
For the CDN_SHAREVIOLATION
Remarks
When you use
the GetOpenFileName
If you
provide a hook procedure for an Explorer-style common dialog box, the system
creates a dialog box that is a child of the default dialog box. The hook procedure
acts as the dialog procedure for the child dialog. This child dialog is based
on the template you specified in the OPENFILENAME structure, or it is a
default child dialog if no template is specified. The child dialog is created
when the default dialog procedure is processing its WM_INITDIALOG
The hook
procedure does not receive messages intended for the standard controls of the
default dialog box. You can subclass the standard controls, but this is
discouraged because it may make your application incompatible with future
versions of the common dialog box. However,
the Explorer-style common dialogs provide a set of messages that the hook procedure
can use to monitor and control the dialog. These include a set of WM_NOTIFY notification messages sent
from the dialog, as well as messages that you can send to retrieve information
from the dialog. For a complete list of these messages, see Explorer-Style
Hook Procedures .
If the hook
procedure processes the WM_CTLCOLORDLG
Do not call
the EndDialog
OFNHookProc is a placeholder for the application-defined or
library-defined function name. The LPOFNHOOKPROC type is a pointer to
either an OFNHookProc or OFNHookProcOldStyle hook procedure.
See Also