CFileDialog and 'Whats this help'
Christine Hagberg -- CHAGBERG@datx.com Monday, January 27, 1997 Environment: Win95, VC++ 4.2-flat I use a CFileDialog to compress files to another file format (I have changed the "save" button to "compress") When I try to use the question mark help, in the upper right hand corner, I never see the WM_HELP command come through my derived class. So I end up with the standard Windows help for a save dialog, not what I want. Is there a way for me to get first crack at all of the messages that go through CFileDialog? Is there atleast a way for me to get first crack at a Help message -- then I can get help that is appropriate for my compress/save dialog? Thanks, Chris
Kenneth A. Argo -- argo@rias.COM Tuesday, January 28, 1997 [Mini-digest: 4 responses] Cut from documentation OFN_SHOWHELP=09 Causes the dialog box to display the Help button. The hwndOwner member = must specify the window to receive the HELPMSGSTRING registered messages = that the dialog box sends when the user clicks the Help button.An = Explorer-style dialog box sends a CDN_HELP notification message to your = hook procedure when the user clicks the Help button. Ken ---------- From: Christine Hagberg[SMTP:CHAGBERG@datx.com] Sent: Monday, January 27, 1997 5:26 PM To: 'MFC List' Subject: CFileDialog and "Whats this help" Environment: Win95, VC++ 4.2-flat I use a CFileDialog to compress files to another file format (I have changed the "save" button to "compress") When I try to use the question mark help, in the upper right hand = corner, =20 =20 I never see the WM_HELP command come through my derived class. So I end up with the standard Windows help for a save dialog, not what I = =20 want. Is there a way for me to get first crack at all of the messages that go = =20 =20 through CFileDialog? Is there atleast a way for me to get first crack = at =20 =20 a Help message -- then I can get help that is appropriate for my =20 compress/save dialog? Thanks, Chris -----From: Christine HagbergThanks, but I want to get the "whats this help" working. That the small question mark in the upper right corner of the dialog. When the user uses this they end up with the standard windows help for the file save dialog. I can get the help button to work but I also need the "whats this help" Any suggestions? Thanks again -Chris. ---------- From: Kenneth A. Argo[SMTP:argo@rias.COM] Sent: Tuesday, January 28, 1997 2:51 PM To: 'Christine Hagberg'; 'MFC List' Subject: RE: CFileDialog and "Whats this help" Cut from documentation OFN_SHOWHELP=09 Causes the dialog box to display the Help button. The hwndOwner member = must specify the window to receive the HELPMSGSTRING registered messages = that the dialog box sends when the user clicks the Help button.An = Explorer-style dialog box sends a CDN_HELP notification message to your = hook procedure when the user clicks the Help button. Ken ---------- From: Christine Hagberg[SMTP:CHAGBERG@datx.com] Sent: Monday, January 27, 1997 5:26 PM To: 'MFC List' Subject: CFileDialog and "Whats this help" Environment: Win95, VC++ 4.2-flat I use a CFileDialog to compress files to another file format (I have changed the "save" button to "compress") When I try to use the question mark help, in the upper right hand = corner, =20 =20 I never see the WM_HELP command come through my derived class. So I end up with the standard Windows help for a save dialog, not what I = =20 want. Is there a way for me to get first crack at all of the messages that go = =20 =20 through CFileDialog? Is there atleast a way for me to get first crack = at =20 =20 a Help message -- then I can get help that is appropriate for my =20 compress/save dialog? Thanks, Chris -----From: "lee@rocsinc.com" Try trapping the WM_HELPINFO message in your dialog. Put the following in the header file : //{{AFX_MSG(CYourDialog) afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); <-- this Put the following in the message map section of the .cpp file : BEGIN_MESSAGE_MAP(CYourDialog, CFileDialog) //{{AFX_MSG_MAP(CYourDialog) ON_WM_HELPINFO () And here's the code : BOOL CYourDialog::OnHelpInfo (HELPINFO* pHelpInfo) { if (pHelpInfo->iContextType == HELPINFO_WINDOW) { AfxGetApp ()->WinHelp (pHelpInfo->dwContextId,HELP_CONTEXTPOPUP); return TRUE; } else { return CFileDialog::OnHelpInfo (pHelpInfo); } } The ClassWizard can automate some of this. Good luck. Lee ---------- From: Christine Hagberg Sent: Monday, January 27, 1997 2:26 PM To: 'MFC List' Subject: CFileDialog and "Whats this help" Environment: Win95, VC++ 4.2-flat I use a CFileDialog to compress files to another file format (I have changed the "save" button to "compress") When I try to use the question mark help, in the upper right hand corner, I never see the WM_HELP command come through my derived class. So I end up with the standard Windows help for a save dialog, not what I want. Is there a way for me to get first crack at all of the messages that go through CFileDialog? Is there atleast a way for me to get first crack at a Help message -- then I can get help that is appropriate for my compress/save dialog? Thanks, -----From: Mike Blaszczak At 17:26 1/27/97 EST, Christine Hagberg wrote: > >Environment: Win95, VC++ 4.2-flat You should upgrade to MFC 4.2b as soon as possible. 4.2-flat is compatible only with beta versions of operating system components, and will evetually cause you grief. >I use a CFileDialog to compress files to another file format (I have >changed the "save" button to "compress") >Is there a way for me to get first crack at all of the messages that go >through CFileDialog? Is there atleast a way for me to get first crack at >a Help message -- then I can get help that is appropriate for my >compress/save dialog? Try PreTrnaslateMessage(). Also, you might want to read up on the EnableHook flag you can toss into m_ofn.Flags. .B ekiM http://www.nwlink.com/~mikeblas/ These words are my own. I do not speak on behalf of Microsoft. This performance was not lip-synched.
Christine Hagberg -- CHAGBERG@datx.com Thursday, January 30, 1997 Environment: Win95, VC++ 4.2-flat Thanks everyone for the suggestions, but I guess I should have listed the things I have tried so far. 1. I have tried putting a help button on the dialog (OFN_SHOWHELP then create a hook procedure OFN_ENABLEHOOK waiting on a CDN_HELP) This works and I can get help if the user uses the help button, but, "Whats this help" still goes straight to CFileDialog directly. 2. I have added a handler for WM_HELPINFO -- ON_WM_HELPINFO () This function never ends up getting called at all. 3. I have tried to trap WM_HELP and WM_HELPINFO in my WindowProc routine. These never occur. 4. I have tried to trap WM_HELP and WM_HELPINFO in a PreTrnaslateMessage(). These never occur Any suggestions would be greatly appreciated. Should I try Subclassing? Thanks Again Chris ---------- From: Christine Hagberg Sent: Monday, January 27, 1997 5:26 PM To: 'MFC List' Subject: CFileDialog and "Whats this help" Environment: Win95, VC++ 4.2-flat I use a CFileDialog to compress files to another file format (I have changed the "save" button to "compress") When I try to use the question mark help, in the upper right hand corner, I never see the WM_HELP command come through my derived class. So I end up with the standard Windows help for a save dialog, not what I want. Is there a way for me to get first crack at all of the messages that go through CFileDialog? Is there atleast a way for me to get first crack at a Help message -- then I can get help that is appropriate for my compress/save dialog? Thanks, Chris
Brad P. Exchange -- Brad.P.Smith@Cognos.COM Saturday, February 01, 1997 >> >Thanks everyone for the suggestions, but I guess I should have listed the >things I have tried so far. > >1. I have tried putting a help button on the dialog (OFN_SHOWHELP then create >a hook procedure OFN_ENABLEHOOK waiting on a CDN_HELP) This works and I can >get help if the user uses the help button, but, "Whats this help" still goes >straight to CFileDialog directly. >2. I have added a handler for WM_HELPINFO -- ON_WM_HELPINFO () This function >never ends up getting called at all. >3. I have tried to trap WM_HELP and WM_HELPINFO in my WindowProc routine. >These never occur. >4. I have tried to trap WM_HELP and WM_HELPINFO in a PreTrnaslateMessage(). >These never occur > >Any suggestions would be greatly appreciated. Should I try Subclassing? ><< For fun, I did a little spelunking using the debugger. CFileDialog is a little different, in that it's a wrapper for the lower-level ::GetOpenFilename() API (owned by COMDLG32). A breakpoint in CFileDialog's OnNotify did not trip for the "What's This" help, meaning that GetOpenFilename does not send a notification message back to the parent. So that'll be no help. A breakpoint in _AfxCommDlgProc, which is the hook proc used by CFileDialog, *also* did not trip, meaning that GetOpenFilename does not send *any* message back to the parent. Unless there's some additional trick, I've come to the conclusion that the COMDLG32 designers didn't *want* you to hook into the "What's This" mechanism. I honestly don't think you can get where you want to go, and still use anything based on GetOpenFilename. :-( Brad.
| Вернуться в корень Архива |