The information in this article applies to:
SUMMARYApplications that need to display icons on the caption bars of File Open and other Common Dialogs can do so by installing a hook function and sending the WM_SETICON message from within the hook function to the common dialog to change its small icon. Note that OFN_ENABLEHOOK flag (or relavant flags for other common dialogs) has to be set for your hook function to be called. MORE INFORMATION
Under Windows 95, every popup or overlapped window can have two icons
associated with it, a large icon used when the window is minimized and a
small icon used for displaying the system menu icon.
Sample CodeThe following code shows how to do this for a File Open Common Dialog:
Note that the lpTemplateName parameter is set to NULL. To just install a
hook, one does not need a custom template. The hook function will get
called if it is sepcified in the structure.
Below is the Comdlg32HkgProc hook callback funtion that chages the small icon. This code below is for the open or save as dialog boxes only.
NOTE: This code calls GetParent() to get the actual window handle of the
common dialog box. This is done for the FileOpen and SaveAs dialog boxes
only. These dialogs, when created with the OFN_EXPLORER look with a hook
and a template (optional), create a seperate dialog to hold all the
controls. This is the dialog handle that is passed in the hook function.
The parent of this dialog is the main common dialog window, whose caption
icon must be modified. The FileOpen and SaveAs dialog boxes with the old
style (no OFN_EXPLORER) need not call GetParent().
All other common dialogs, such as ChooseColor and ChooseFont, behave as the the Windows version 3.1 common dialogs behaved, so the code listed in this article does not need to call GetParent(). It can just send the WM_SETICON message to the hDlg that is passed to the hook function. Additional query words: user common dialog
Keywords : kbcode kbCmnDlg kbCmnDlgFileO kbCmnDlgSave kbNTOS400 kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS95 kbWinOS98 |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |