please dont rip this site Prev Next

OFNHookProc info  Overview  Group

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 hook procedure. In this case, the dialog box will have the old-style user interface.

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 function to get the handle to the Open or Save As dialog box window.
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 message, lParam is a pointer to an OPENFILENAME structure containing the values specified when the dialog box was created.

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 and CDN_FILEOK notification messages, the hook procedure should return a nonzero value to indicate that it has used the SetWindowLong function to set a nonzero DWL_MSGRESULT value.

Remarks

When you use the GetOpenFileName or GetSaveFileName functions to create an Explorer-style Open or Save As common dialog box, you can provide an OFNHookProc hook procedure. To enable the hook procedure, use the OPENFILENAME structure that you passed to the dialog creation function. Specify the pointer to the hook procedure in the lpfnHook member and specify the OFN_ENABLEHOOK flag in the Flags member.

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 message. After the child dialog processes its own WM_INITDIALOG message, the default dialog procedure moves the standard controls, if necessary, to make room for any additional controls of the child dialog. The system then sends the CDN_INITDONE notification message to the hook procedure.

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 message, it must return a valid brush handle for painting the background of the dialog box. In general, if it processes any WM_CTLCOLOR* message, it must return a valid brush handle for painting the background of the specified control.

Do not call the EndDialog function from the hook procedure. Instead, the hook procedure can call the PostMessage function to post a WM_COMMAND message with the IDABORT value to the dialog box procedure. Posting IDABORT closes the dialog box and causes the dialog box function to return FALSE. If you need to know why the hook procedure closed the dialog box, you must provide your own communication mechanism between the hook procedure and your application.

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

GetOpenFileName, GetSaveFileName, OFNHookProcOldStyle, OPENFILENAME


file: /Techref/os/win/api/win32/func/src/f65_14.htm, 7KB, , updated: 2000/4/7 11:19, local time: 2024/11/25 01:53,
TOP NEW HELP FIND: 
18.117.12.181:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/techref/os/win/api/win32/func/src/f65_14.htm"> OFNHookProc</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .