WinHelp() emulation of HtmlHelp()

  • Thread starter Thread starter hector santos
  • Start date Start date
H

hector santos

Guest
I have many apps that use *.CHM help and when it was compiled under 32 bit it worked as expected.

When we first ported from the old *.HLP to *.CHM files, I was able to keep with older WinHelp() and commands calls by overriding it with a virtual WinHelp(). Within this virtual function, the WinHelp() command translation to HtmlHelp() was done.

This is a MDI application and in a inherited CScrollView editor window, when F1 is hit at the editor cursor position CEditoView::OnHelp() is called which calls:

void CEditorView::OnOpenHelpAtCursor()
{
char buf[1024] = { 0 };
strncpy(buf,GetKeywordAtCursor(),sizeof(buf)-1);
AfxGetApp()->WinHelp((DWORD_PTR)&buf, HELP_KEY);
}

Note the DWORD_PTR. I was porting the app to 64 bit and that was one of the changes to make.

The problem is that throws an assertion fault (under debug) and it doesn't bring up the *.CHM help.

In tracing the Win32 and Win64 versions, I found the AfxGetApp()->WinHelp() does not call the expected CMainFrame:WinHelp() which has the emulation and translation to HtmlHelp():


WIN32 F1
CEditorView::OnHelp()
CEditorView::OnOpenHelpAtCursor()
AfxGetApp()->WinHelp()
CWinApp::WinHelp(DWORD_PTR dwData, UINT nCmd)
This calls the pMainWnd->WinHelp() which properly calls my CMainFrame::WinHelp()

WIN64 F1
CEditorView::OnHelp()
CEditorView::OnOpenHelpAtCursor()
AfxGetApp()->WinHelp()
CWinApp::WinHelp(DWORD_PTR dwData, UINT nCmd)
This calls the pMainWnd->WinHelp() which calls CWnd::WinHelp() instead and the fault occurs.

The only diff I can see, is the Win32 version was using the V140_XP platform toolkit and WIN64 is just using V140. I don't want to use the XP version for our new 64 bit version. But I tried it anyway, Win64 v140_XP compile and it still is a+problem. So it seems related to 64 bit compiles.

So why can't AfxGetApp()->WinHelp() behave as expected and call the CMainFrame::WinHelp() under 64 bit?

I must be missing something.




Hector Santos, CTO Santronics Software, Inc. Santronics Software, Inc.

Continue reading...
 
Back
Top