Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Failed to Launch Help

693 views
Skip to first unread message

Jonathan Wood

unread,
May 6, 2010, 11:15:09 PM5/6/10
to
I created a brand new MFC dialog-based application using Visual Studio 2010.
I chose the option to create context-sensitive help. I can manually open the
CHM file and it looks fine. But when I either hit F1 or click the Help
button (ID_HELP) in my dialog box, I get a message box that says "Failed to
launch help."

After considerable time, I've managed to isolate the routine that is
failing. AfxHtmlHelp() loads hhctrl.ocx and gets the function address for
"HtmlHelpW". Both of these steps are successful. But when it calls
HtmlHelp() via the pointer, 0 is returned. And when that value of 0 is
returned back to CWnd::HtmlHelp(), the "Failed to launch help" message is
displayed.

One thing I didn't quite understand is that the hWnd argument sent to
AfxHtmlHelp() shows in the debugger as "hWnd = 0x00430638 {unused=0 }". As
you can see, it's not NULL but I don't know if the "unused" comment is just
because it's not accessible or what.

Does anyone have any ideas on this? I don't know a whole lot about HTML help
but this is the main dialog box created by the Wizards so I kind of figure
this would work right out of the box. I'm not sure where else to look.

Thanks!

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com

Rob Chandler [MVP]

unread,
May 7, 2010, 7:25:44 AM5/7/10
to
So you are using the Wide version of HTMLHelp(). So using PWideChar right?

Can you write some standalone test code that calls help ... do you still
have problems?

> But when it calls HtmlHelp() via the pointer, 0 is returned. And when that

> value of 0 is returned...

Normal the HtmlHelp() call returns a handle to the help window created. But
something
fails so 0 is returned.

I'm coming from Delphi but the calls are the same

HtmlHelp(hwndCaller: HWND; pszFile: PWideChar; uCommand: UInt; dwData:
DWORD): HWND;

hwndCaller can be 0 -- Which I prefer since the help window is not locked
ontop of the main window.

pszFile - Should be a full path to your CHM.


Some examples you should try in a test file...

EG. To open a CHM file

HtmlHelp(GetDesktopWindow, "c:\Help.chm", HH_DISPLAY_TOPIC, 0);

EG. To open a CHM file at a particular Topic

HtmlHelp(GetDesktopWindow, "c:\Help.chm::/Intro.htm", HH_DISPLAY_TOPIC,
0);

EG. To open a CHM file at a particular Topic and use a Window definition
called "Mainwin".

HtmlHelp(GetDesktopWindow, "c:\Help.chm::/Intro.htm>Mainwin",
HH_DISPLAY_TOPIC, 0);

EG. To open a CHM file using context help = 1001

HtmlHelp(GetDesktopWindow, "c:\Help.chm", HH_HELP_CONTEXT, 1001);

EG. Close help

HH.HtmlHelp(0, nil, HH_CLOSE_ALL, 0);

Rob

"Jonathan Wood" <jw...@softcircuits.com> wrote in message
news:%23ZOmBOZ...@TK2MSFTNGP02.phx.gbl...

Jonathan Wood

unread,
May 7, 2010, 11:13:36 AM5/7/10
to
"Rob Chandler [MVP]" <sup...@nospam.helpware.net> wrote:

> So you are using the Wide version of HTMLHelp(). So using PWideChar right?

I don't know what PWideChar is. I'm using MFC, TCHARs, with the project set
to use Unicode.

> Can you write some standalone test code that calls help ... do you still
> have problems?

My window class has an HtmlHelp() method. When I call it with a topic value
or 0, the help window *does* display. So I guess the function is working and
the error is from having an invalid topic ID. Guess I'll need to dig further
into my help files and see why it's not sending a valid topic ID.

> Normal the HtmlHelp() call returns a handle to the help window created.
> But something
> fails so 0 is returned.

Yes, I know.

Anyway, that gives me a direction to look further.

Thanks.

Jonathan

0 new messages