|
Technology Information about HTML Help and Web Help |
|
How to Create Context-Sensitive HTML Help in an MFC ApplicationThe information in this article applies
to:
SUMMARYThis article describes how to create context-sensitive HTML Help in an MFC application.This is actually the second step of a two-part process. Step one describes how to prepare a compiled help file for context-sensitive help. For additional information, please see the following article in the Microsoft Knowledge Base: This article assumes that the MFC Visual C++ application has been set up to use HTML Help. For additional information, please see the following article in the Microsoft Knowledge Base: This article assumes that the project was created using the MFC AppWizard (exe). You must select the context-sensitive help option in step 4 for SDI and MDI tracks in the MFC AppWizard (exe). MORE INFORMATIONPerform the following steps in your MFC Visual C++ Application:
For the "What's this" help, the MFC framework sends a WM_HELPHITTEST message (see TN028 for more details) to each window, starting with the window under the mouse cursor and moving up the hirearchy. If none of the windows handle this message, the CFrameWnd handler for this message returns the general topic-value, which is passed on to CWinApp::WinHelp in dwData. To get "What's this" help to work the way F1 help works (which is how it works in Dialogs according to DS_CONTEXTHELP), it is necessary to provide a WM_HELPHITTEST handler. A generic one that returns the ID of the child window under the cursor could be written as follows (gleaned from CControlBar::OnHelpHitTest): LRESULT CMyView::OnHelpHitTest(WPARAM, LPARAM lParam)
{
ASSERT_VALID(this);
// Find the child window ID under mouse cursor
int nID = OnToolHitTest((DWORD)lParam, NULL);
if (nID != -1)
return HID_BASE_CONTROL+nID;
nID = GetDlgCtrlID();
return nID != 0 ? HID_BASE_CONTROL+nID : 0;
}
版权所有 © 2001-2006 飞软科技。 |