DLL registration with regsvr32.exe freezes when unit HtmlHelpViewer is used in DLL sources in Delphi XE or Delphi XE2 Update 3. Just add the unit to interface uses list. The main project (that uses DLL) freezes on exit too.
How to fix the issue?
Thanks for the help!
STEPS TO REPRODUCE THE ISSUE AND ISSUE IN SUGGESTED FIX:
1). Please create the following DLL:
library Test;
uses
ComServ,
HtmlHelpFixer,
HtmlHelpViewer;
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;
begin
end.
2). Also create the following BPL linked to this DLL (by -LUTestBpl dcc32 parameter for example):
package TestBpl;
requires
Vcl;
end.
3). Then just execute: regsvr32.exe /s Test.dll. OS Windows 7 32-bit.
Update
According to the latest comments on the QC report submitted by Altaveron, this problem will be resolved in the next Delphi update, update 4. And indeed, Altaveron now confirms that update 4 does resolve the issue.
This is a known problem with the MS HTML help control, hhctrl.ocx. The best description of it that I am aware of is at the HelpWare FAR HTML FAQ. There are many QC reports describing the issue: 48983, 67463, 78998, 89616.
According to the latest QC report, this is fixed in XE2 but you report otherwise and I’d be inclined to believe you. Especially as a comparison of the source for the
HtmlHelpViewerunit from XE and XE2 reveals no changes that appear related to this issue.It’s quite hard to work around the issue since the code that needs to be modified is buried deep inside the
HtmlHelpViewerunit. I’ve had to resort to patching theHtmlHelpAPI call. Like this:Include this unit early in your .dpr
useslist, before any unit that does anything with HTML help.The version of the code that I use does a little more and takes steps to ensure that any open help windows are closed when the DLL unloads. This no longer happens because we have stopped sending
HH_CLOSE_ALL.You will want to make sure that any help windows are shut down then keep track of the window handles returned by
HtmlHelpcalls, which you can now intercept. Then at shutdown send aWM_CLOSEmessage to those windows which replaces the missingHH_CLOSE_ALLcall toHtmlHelp.However, I believe that the code above should get you over your immediate hurdle with regsvr32 which won’t be showing help windows.
Feel free to do some experimentation! At the very least, the code above gives you entry points with which you can modify the behaviour of the
HtmlHelpViewerunit.