I am using XE7 64 and I am looking for a strategy to solve several problems I am having when displaying HTMLHelp files from within my applications (I have added the HTMLHelpViewer to my uses clause). The issues are the following: 1) Ctrl-c does not copy text from topics; 2) The helpviewer cannot be accessed when a modal dialog is active.
The source of the problems are presumably attributable to the htmlhelpviewer running in the same process as the application. Is there a way to have the built-in htmlhelpviewer launch a new process? If not, then will I need to launch HH.EXE with Createprocess?
You could launch the help file viewer as a separate process, but I think that will make controlling it even more complex. My guess is that the supplied HTML help viewer code is the root cause of your problems. I've always found that code to be extremely low quality.
I deal with that by implementing an
OnHelp
event handler that I attach to theApplication
object. This event handler calls theHtmlHelp
API directly. I certainly don't experience any of the problems that you describe.My code looks like this:
Include that unit in your project and you will be hooked up to handle help context requests. Some comments on the code:
OnHelp
event handler is limited to just my needs. Should you need more functionality you'd have to add it yourself.TFormLayoutPrefernce
. It's one of my preference classes that manages per-user preferences. It stores away the window's bounds rectangle, and whether or not the window was maximised. This is used to ensure that the help window is shown at the same location as it was shown in the previous session. If you don't want such functionality, strip it away.ReportError
andReportErrorFmt
are my helper functions to show error dialogs. You can replace those with calls toMessageBox
or similar.