Discussion:
GPF with Context Sensitive Help
(too old to reply)
hls
2009-08-30 03:40:17 UTC
Permalink
I have setup my MFC application the help calls to display popups as so:

/////////////////////////////////////////////////////////////////////////////
LONG CHelpPage::OnHelp(UINT, LONG lParam)
{
if (m_nHelpIDs == 0) {
AfxMessageBox("No Help Index for this dialog");
return 0;
}

//
// this will come from a control
//

if(lParam != 0) {
LPHELPINFO pHelpInfo = (LPHELPINFO)lParam;
CString sHelp;
sHelp.Format("%s::/popups.txt",AfxGetApp()->m_pszHelpFilePath);
HtmlHelp(
pHelpInfo->hItemHandle,
sHelp,
HH_TP_HELP_WM_HELP,
(DWORD)(LPVOID)GetHelpIDs());
return 0;
}

//
// this will come from the help sheet
//

if(m_nIDHelp != 0) {
HtmlHelp(NULL,
AfxGetApp()->m_pszHelpFilePath ,
HH_HELP_CONTEXT, m_nIDHelp);
}
return 0;
}

So when lParam (LPHELPINFO) is not NULL, HH_TP_HELP_WM_HELP command is
called. GetHelpIds() returns the array of control ids vs IDH__xxxx
values for the page.

Ok, this works. If F1 is hit or ? icon is placed on the control field,
the POPUP text is shown.

Now, while the POPUP is still showing, intermittently, if I hit/click
another control, ?, Cancel, etc. I a GPF in the WINCORE.CPP RTL. A
stack trace does not show anything revealing.

It seems to be related of making sure the POPUP disappears before
anything happens.

What am I doing wrong with the above? Do I need to do something else?

==
hls
2009-08-30 07:00:23 UTC
Permalink
For the archives, the solution is to use the HH_INITIALIZE and
HH_UNINITIALIZE commands in the CWinApp::InitInstance and
CWinApp::ExitInstance respectively.

--
HLS
Post by hls
/////////////////////////////////////////////////////////////////////////////
LONG CHelpPage::OnHelp(UINT, LONG lParam)
{
if (m_nHelpIDs == 0) {
AfxMessageBox("No Help Index for this dialog");
return 0;
}
//
// this will come from a control
//
if(lParam != 0) {
LPHELPINFO pHelpInfo = (LPHELPINFO)lParam;
CString sHelp;
sHelp.Format("%s::/popups.txt",AfxGetApp()->m_pszHelpFilePath);
HtmlHelp(
pHelpInfo->hItemHandle,
sHelp,
HH_TP_HELP_WM_HELP,
(DWORD)(LPVOID)GetHelpIDs());
return 0;
}
//
// this will come from the help sheet
//
if(m_nIDHelp != 0) {
HtmlHelp(NULL,
AfxGetApp()->m_pszHelpFilePath ,
HH_HELP_CONTEXT, m_nIDHelp);
}
return 0;
}
So when lParam (LPHELPINFO) is not NULL, HH_TP_HELP_WM_HELP command is
called. GetHelpIds() returns the array of control ids vs IDH__xxxx
values for the page.
Ok, this works. If F1 is hit or ? icon is placed on the control field,
the POPUP text is shown.
Now, while the POPUP is still showing, intermittently, if I hit/click
another control, ?, Cancel, etc. I a GPF in the WINCORE.CPP RTL. A stack
trace does not show anything revealing.
It seems to be related of making sure the POPUP disappears before
anything happens.
What am I doing wrong with the above? Do I need to do something else?
==
Loading...