Question

I'm trying to implement CHM help file into my app written in C++ Builder but I always get "no context-sensitive help installed".

I added these lines:

#include "HtmlHelpViewer.hpp"

OnCreate.. (Form1)

Application->HelpFile = ExtractFilePath(Application->ExeName) + "myfile.chm";

I've set HelpContext via object inspector and also tried manually to call

Application->HelpContext(170);

But, it's not working. What to do?

Was it helpful?

Solution

You need to force the linker to include the code. It's not enough just to include the header file.

Try adding this to your code:

#include "HTMLHelpViewer.hpp"
#pragma package(smart_init)
#pragma link "HTMLHelpViewer"

I'm assuming that you don't need to add the Vcl unit scope name since you did not do so in the code in the question. But if you did need to do that the code would look like this:

#include "Vcl.HTMLHelpViewer.hpp"
#pragma package(smart_init)
#pragma link "Vcl.HTMLHelpViewer"

Judging by your comments, and this Embarcadero forum thread, I suspect that you are using a version that requires unit scope names. You probably have specified unit scope aliases that mean you can omit the unit scope name in the header file #include. But it seems that you cannot omit the unit scope name in the #pragma link directive.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top