Opening Help using F1 from MDI Form

Hi experts,
I have a problem opening (html) Help from an MDI form using F1, i.e. nothing happens.

From MDI child forms when I press F1 I can open Help but if I close all the child forms and have only the MDI form open if I then press F1 nothing happens.

I've tried setting HelpContextId value to 0 and 1000 (1000 being Introduction topic) but there's no difference.

Any ideas?

     /Michael
gem56Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
If nothing will work, you should try to catch the F1 Key in the MDI Main form and try to open the Help from code

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gem56Author Commented:
Hi angelIII,
I wanted to do that but I'm not aware of how to do that in the MDI form, as it doesn't provide any KeyDown, etc. events.
Do you have a specific example how I can do that?

/Michael
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

gem56Author Commented:
Hi Preece,
The link that you provide above seems to go in the same direction as angelIII's suggestion, i.e. trap the F1 key event and manually call HtmlHelp.

As I didn't have to do anything in the first place to map F1 to the Help function I don't know how to change that mapping to the HandleHelpContext function, defined in that link. I know how to "map keys to functions" for normal MDI child forms that provide KeyDown or KeyPress events but if teh Form doesn't provide such events how would you do it then?

Do you know how to do that?

/Michael
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Actually, i tried out the code in the link, and it works perfectly

Just take your F1 Help menu mapped to the F1 ShortCut key, open it's Click Event, and put this code in it:

   Call HtmlHelp(Me.hWnd, App.HelpFile, HH_DISPLAY_TOPIC, 0)

Cheers
Guy Hengel [angelIII / a3]Billing EngineerCommented:
of course, you need to have the module with the other code also in your project...
PreeceCommented:
If the solution in the link works for you, please be sure to split the points between angelIII and I.  ; - )

Preece
gem56Author Commented:
Hi guys,
It works 99% the way I'd like it to with one hickup. In my Menu I have two entries for help. The first uses HH_DISPLAY_TOC and the second HH_DISPLAY_SEARCH (which for some reason doesn't work, see my open question (http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21477426.html) if  you want some points).

Back to the 1%. How can I map F1 to the module function. Currently I've mapped DISPLAY_SEARCH menu item (using HH_HELP_CONTEXT) but I'd really like to have that go to "Search"tab and have F1 independantly go to the module function. I created another Menu entry and unchecked Visible property but it still appears in the menuBar.

Is there another way of mapping F1 to a function without going via MenuEditor?

/Michael
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I think you then need to use subclassing to get the key_press events on the MDI form... Search for subclassing on the NET
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.