The information in this article applies to:
SYMPTOMSWhen you press the F1 key to display help for a window that is not a descendant of the application's main window, it does not display the proper help text. CAUSEMFC assumes that the currently active window is a descendant of the main window. So, for windows that are children of the desktop, MFC routes WM_COMMANDHELP to the mainframe instead of the active window. RESOLUTIONAdd an ID_HELP command handler in the CMainFrame that searches for the active window based on the window with the current focus and walks up the parent tree sending the WM_COMMANDHELP message. Use the code shown in the sample code section. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual C++ version 4.0. MORE INFORMATION
When you press the F1 key, an ID_HELP command message is generated and is
usually routed and handled in the application's main frame message map
using CFrameWnd::OnHelp(). Then, the OnHelp functions (CFrameWnd and CWnd)
finds the active window using ::GetLastActivePopup(hWnd), thereby passing
the handle to the application's main frame. Unfortunately, this only
returns windows handles that are a descendant of hWnd. If another top-level
window was active when you pressed the F1 key, the main frame window is
still used and the subsequent WM_COMMANDHELP messages is never sent to the
correct active window.
Sample Code
© Microsoft Corporation 1997, All Rights Reserved. Additional query words:
Keywords : kbprg kbDocView kbMFC kbVC |
Last Reviewed: January 20, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |