8 Replies Latest reply on Sep 8, 2008 11:21 AM by Philip_K._Wilson

    After closing Help file, app does not regain focus

    word_wiz
      When I launch Help, the Help file obviously becomes the active window. But when I close the Help file, I'd like the app that I launched it from to become the active window. Currently it does not.

      Is there a setting that will allow me to achieve this? I tested it against IE, which does become the active window after closing the Help file. However, I noticed that the Help file is always associated with the app, i.e., if I close the app while the Help file is open, both the app and the Help file close. I don't necessarily want that, but I do want to return to the app after closing the Help file w/o having to click the app to get back to where I was.

      Thanks, everyone.. jd
        • 1. Re: After closing Help file, app does not regain focus
          Level 2
          I've never seen a closed HTMLHelp file not give focus back to the calling program. What does get focus?

          When you close the app the help closes. This is sometimes annoying. For example, I have a troubleshooting script in my help file that has the user close the program - poof! there go the instructions. But is usually something we live with. This is because in the Windows world, windows belong to the program that created them. The only way I know to avoid this is to have hh.exe open the help. This is the program that opens the help window when you click on it in Windows Explorer. It can be called by the app instead of using the HtmlHelp API, but is probably not worth doing. It will make all the context sensitive help more difficult to implement.

          john
          • 2. Re: After closing Help file, app does not regain focus
            word_wiz Level 1
            When I close the Help file, nothing has focus. I agree that it can be annoying that the Help file closes when the app does. I'm not looking for that, but I would live with it.

            So is there a way to tell the Robo-created Help file to give focus back to the "host" app upon closing?

            Thanks for your response, John.
            • 3. Re: After closing Help file, app does not regain focus
              MergeThis Level 4
              I believe that can only be accomplished in the app, by the developers. That is, instructions to open and close can only go in one direction, from app to help.


              Good luck,
              Leon
              • 4. Re: After closing Help file, app does not regain focus
                word_wiz Level 1
                But when the Help file is open, that's the app that's in control of giving focus back to the original app. At least, the developers tell me it's the responsibility of the Help file.
                • 5. Re: After closing Help file, app does not regain focus
                  Pete Lees Level 2
                  Hi, word wiz,

                  I think there are two possibilities here.

                  1) In their context help calls, your developers may not be passing to your .chm file the "handle" of the window from which help is called. The consequence of this is that the help file is not owned by the window, and as a result focus is not returned to the window when the help file is closed. You can read more about this here:

                  http://forums.madcapsoftware.com/viewtopic.php?f=8&t=4101

                  2) There appears to be something slightly wrong with the ehlpdhtm.js file that is compiled into some (perhaps all?) RoboHelp-generated .chm files. As far as I can see, the JavaScript functions that are responsible for the problem are the ones enclosed by the following two comments in the ehlpdhtm.js file:

                  //Begin to support previous HHActiveX invoking
                  ...
                  //End to support previous HHActiveX invoking

                  These JavaScript functions seem to be responsible for activating the HHActiveX DLL, which I believe implements RoboHelp add-in features like browse sequences and Glossary tab in a .chm file. In any event, if I comment out these functions, a .chm file that previously failed to return focus to the Windows desktop now does so. Obviously, though, by disabling these functions I lose the additional features that the DLL provides.

                  Pete
                  • 6. Re: After closing Help file, app does not regain focus
                    word_wiz Level 1
                    The developers are going to try "passing the handle." I'll let you know how it goes.

                    Many thanks for your help.. jd
                    • 7. Re: After closing Help file, app does not regain focus
                      Philip_K._Wilson
                      Have you had any further progress with this? I have the same problem (see this thread: My version of the RoboHelp focus problem )

                      The thing I find most irritating is that the behavior I see is IDENTICAL whether a CHM file is called from my app or directly via double-click from Windows Explorer. A CHM file developed with RoboHelp does NOT return focus in either case. A CHM file from another source returns the focus no matter what.

                      AND... The help file for RoboHelp itself DOES NOT return focus to RoboHelp! ! !
                      • 8. Re: After closing Help file, app does not regain focus
                        Philip_K._Wilson Level 1
                        Pete Lees solution a few posts above this FIXES the problem. I commented out the portion of the javascript file he referenced and now the rebuilt CHM file returns focus regardless of who calls it.

                        Thanks for the help!