.NET Application Help - ALink Fix

Mon, 2 Feb 2004
Back to .NET Application Help tutorial Page


Michael [ESRI] and I recently spent time helping David [Unisys Australia] get Associative Link help calls working under VB .NET. In the end we asked Paul O'Rear to get involved (ex-Help MVP now working for Microsoft) who confirmed that .NET ALink support for .NET applications indeed seems to be broken. I suggested that the best fix would be to trap the help events and redirect them to a standard HH API call HH_ALINK_LOOKUP. Paul said this was easy to do using .NET's HelpRequested event and very kindly wrote a code example to demonstrated this

Caveat

This is ''unsupported code'. At this stage this is simply a generous late night effort by Paul to help an on-line user and 'not an official response from Microsoft' in any shape or form. Paul will report this bug to the appropriate Microsoft dev team. If we hear more we will report back to you here.

Background Info: MS HTML Help supports two types of Keyword Indexes (A and K). The main difference is that K Index Keywords are visible and appear in the Index control in the optional Index navigation control (left side of the HTML Help Viewer window). Thus to display a help topic using a hidden Keyword you must use Associative Links (Associative Index Keywords).

 - Rob Chandler [MS Help MVP]


From Paul ...

<snip>

...the code is straightforward enough that your developer can choose to re-implement for themselves if they wish to have their own sense of ownership over it and thereby support it for themselves. It's straight HTML Help API coding. No smoke and mirrors or anything undocumented.

What I did was to take some sample code from a PSS article found at the following URL and added a few additional functions to it to help with what we needed to accomplish:

http://support.microsoft.com/?kbid=317406

I added two public methods to the hhinterop.cs file that the article talks about; one for keyword lookups and one for ALink lookups.

I created a generic HelpRequested() method in the main application which gets called by the HelpRequested event for any control in the application. I set these on the Event property pages for button1 and button2 in this sample.

I added a HelpProvider control to the app and set it to point to Rob's sample .chm file in the same folder with the application.

I set all of the controls' "ShowHelp on helpProvider1" properties to false on each control's property page.

I set an "HelpKeyword on helpProvider1" value to both of the buttons on their property pages.

The overall logic then is that the ShowHelp() method will not be called, but the HelpRequested() event will fire, kicking of our handler. The handler then is generic and obtains the active control's keywords from the resources at runtime and then passes it to the help system. This saves you from having to write a unique handler for every control.

Try it out and let me know if you have any questions -

Thanks!
Paul

 


Home Page | Back to .NET Application Help tutorial Page