In Delphi, the application's main help file is assigned through the TApplication.HelpFile property. All calls to the application's help system then use this property (in conjunction with CurrentHelpFile) to determine the help file to which help calls should be routed.
In addition to TApplication.HelpFile, each form also has a TForm.HelpFile property which can be used to specify a different (separate) help file for help calls originating from that specific form.
If an application's main help window is already open however, and a help call is made display help from a secondary help file, both help windows hang. Neither of the help windows can now be accessed, and neither can be closed. The only way to get rid of the help windows is to close the application, which results in both help windows being automatically closed as well.
Example:
Application.HelpFile := 'Main Help.chm'; //assign the main help file name
Application.HelpContext(0); //dispays the main help window
Form1.HelpFile := 'Secondary Help.chm'; //assign a different help file
Application.HelpContext(0); //should display a second help window
The last line of code above opens the secondary help window (but with no content) and then both help windows hang.
My Question is this:
Is it possible to display two HTMLHelp windows at the same time, and if so, what is the procedure to be followed?
If not, is there a way to tell whether or not an application's help window is already open, and then close it programatically before displaying a different help window?
(I am Using Delphi 2007 with HTMLHelp files on Windows Vista)
UPDATE: 2008-09-18
Opening two help files at the same time does in fact work as expected using the code above. The problem seems to be with the actual help files I was using - not the code.
I tried the same code with different help files, and it worked fine.
Strangely enough, the two help files I was using each works fine on it's own - it's only when you try to open both at the same time that they hang, and only if you open them from code (in Windows explorer I can open both at the same time without a problem).
Anyway - the problem is definitely with the help files and not the code - so the original questions is now pretty much invalid.
UPDATE 2: 2008-09-18
I eventually found the cause of the hanging help windows. I will post the answer below and accept it as the correct one for future reference. I have also changed the questions title.
Oops... It seems that I cannot accept my own answer...
Please vote it up so it stays at the top.