Help won't yield focus

This forum is for all Flare issues related to the Microsoft HTML Help target.
This target produces "CHM" files in the output.
Post Reply
bhayes5
Jr. Propeller Head
Posts: 1
Joined: Thu Aug 03, 2006 7:45 am

Help won't yield focus

Post by bhayes5 »

I have the \"Use Topmost Window Style\" unchecked but the help (*.chm) does not yield focus (i.e., go to background) to the application. Specifically, if I open the application then open the help file, the help file window is on top. Clicking on the application window should move it to the top and the help window behind. But this does not happen; the help window stays on top. I actually have several application/help files that behave this way but other application/help files that do surrender focus. Any suggestions?

Thanks.
Bill
rmaryniuk
Jr. Propeller Head
Posts: 1
Joined: Thu Jul 05, 2007 11:49 am
Location: Calgary, Alberta Canada

Help file will not yield focus

Post by rmaryniuk »

Has anyone found a solution to this problem? I've also seen the same issue and we are looking for a way for users to tile the application and Help windows. By clicking one, it brings it to the front. this is extremely useful when users are trying to read a Help topic and execute the instructions in the application window.
Ruth
niamhc
Jr. Propeller Head
Posts: 1
Joined: Mon Nov 20, 2006 5:44 pm

Post by niamhc »

When I had this issue it was something that needed fixing on the developer side of things. It had something to do with how the Help was incorporated with the application. Can't offer any more details I'm afraid, it was ages ago and I don't think I knew the details of it at the time, but it was definitely not a Flare issue.
Pete Lees
Sr. Propeller Head
Posts: 150
Joined: Thu Feb 09, 2006 12:33 pm
Location: Bracknell, Berkshire, UK

Re: Help won't yield focus

Post by Pete Lees »

This is a very late response, and I imagine that Bill has now found the solution. But for the benefit of anyone else who may be searching these forums for a solution to the same issue, here is an explanation of why HTML Help files usually retain focus when called from a program, and a suggested workaround.

According to Microsoft's HTML Help API documentation (http://msdn2.microsoft.com/en-us/librar ... S.85).aspx):
Any help window that you create through the HTML Help API is owned by the calling, or parent, program. This allows the help window to stay on top of its parent, yet not be on top of any other program that has focus.
So the fact that the help window retains focus is actually the standard behaviour.

If you look at a typical HTML Help API call, you'll see that the first parameter specifies the "handle" of the window from which help is called:

Code: Select all

HtmlHelp(hwndCaller,"YourHelpFile.chm",HH_HELP_CONTEXT,1001);
If the developer passes "null" rather than the window handle as the first parameter of the call, the help window is no longer owned by the calling program, and so does not retain focus. Here is an example of a modified call:

Code: Select all

HtmlHelp(0,"YourHelpFile.chm",HH_HELP_CONTEXT,1001);
There's a drawback to this, though: when called in this way, the help window is no longer bound by the actions of the calling program. So if the user closes or minimises the program, the help window isn't closed or minimised as well.

Pete
MkMr
Propeller Head
Posts: 17
Joined: Tue Sep 25, 2007 7:29 am

Re: Help won't yield focus

Post by MkMr »

If you are using C# to launch your help file you might wish to see the end of the following thread for a way around this:

http://forums.madcapsoftware.com/viewto ... 948#p37948

Mark
Post Reply