Lazarus

Programming => LCL => Topic started by: William Marshall on January 25, 2020, 08:16:04 pm

Title: Help with Help
Post by: William Marshall on January 25, 2020, 08:16:04 pm
I've written a small program ("FWCalc") and a small CHM help file ("FWCalc.chm", via HelpNDoc) to go with it.  The help file is shown when a Help button is pressed.  Based on the "Add Help to Your Application" page in the Lazarus wiki, the FormCreate for the main form contains:
Code: Pascal  [Select][+][-]
  1. CHMHelpDatabase1.Filename := ChangeFileExt(Application.ExeName, '.chm');
  2. CHMHelpDatabase1.KeywordPrefix := 'FWHelp';   { Assigned in HelpNDoc }
  3. LHelpConnector1.LHelpPath := IncludeTrailingBackSlash(ExtractFileDir(Application.ExeName)) + 'lhelp.exe';
The AutoRegister property of both CHMHelpDatabase1 and LHelpConnector1 is set to true in the Object Inspector.

     btnHelpClick is:
Code: Pascal  [Select][+][-]
  1. ShowHelpOrErrorForKeyword('', 'FWHelp');
When I press the Help button the help window appears showing the first topic ("Introduction") along with an error dialog saying "Resource unavailable:ms-its:FWCalc:://Introduction.htm.  Press OK to risk data corruption.  Press Abort to kill the program.", and about 10 seconds later another error dialog appears saying "lhelp does not respond".  But when the error dialogs are closed, Help seems to work just fine.  What do I have to do to avoid these errors?
Title: Re: Help with Help
Post by: marcov on January 25, 2020, 08:21:24 pm
If I look at the ms-its, there is no extension. Try to add .chm to the extension
Title: Re: Help with Help
Post by: William Marshall on January 25, 2020, 08:51:39 pm
Sorry, but I don't know what ms-its means. How do I "add .chm to the extension"?
Title: Re: Help with Help
Post by: lainz on January 25, 2020, 09:12:25 pm
ms-its is in the error message you posted...

And for what I'm seeing in your code you're already replacing the .exe extension with .chm so the problem is another... if you're on Windows and your application has an extension, if not you're not replacing nothing.
Title: Re: Help with Help
Post by: marcov on January 25, 2020, 09:12:32 pm
Sorry, but I don't know what ms-its means.

Well, you posted it in your error message?!?!

Quote
"Resource unavailable:ms-its:FWCalc:://Introduction.htm. 

Quote
How do I "add .chm to the extension"?

From what you've posted, I suggest to add it to

Quote
CHMHelpDatabase1.KeywordPrefix := 'FWHelp';
Title: Re: Help with Help
Post by: William Marshall on January 26, 2020, 05:50:32 pm
    What I meant was I didn't understand the error message at all.  I have only the vaguest idea what a resource is.  So ms-its is like a variable name for "FWCalc:://Introduction.htm"???   Anyway, I tried a bunch of little changes but nothing helped.  When I went back to my original code, the error is "... ms-its:FWCalc.chm:://Introduction.htm ...", so the ms-its has an extension.  Maybe I forgot it in my original post.  Sorry.  Still, Help works; I just have to get past two error dialogs to get to it.
    What am I doing/not doing that causes those errors?
Title: Re: Help with Help
Post by: lucamar on January 26, 2020, 06:03:47 pm
    What I meant was I didn't understand the error message at all.  I have only the vaguest idea what a resource is.  So ms-its is like a variable name for "FWCalc:://Introduction.htm"???   Anyway, I tried a bunch of little changes but nothing helped.  When I went back to my original code, the error is "... ms-its:FWCalc.chm:://Introduction.htm ...", so the ms-its has an extension.  Maybe I forgot it in my original post.  Sorry.  Still, Help works; I just have to get past two error dialogs to get to it.
    What am I doing/not doing that causes those errors?

ms-its is the protocol part of the URI , like in: "http:", "ftp:", etc. It just happens that it is a Microsoft-specific protocol and that it's part of the CHM specification (if there is one). For your purposes you can just consider it as part of the HTML help URLs and ignore it.

As for those errors you're seeing ... sorry, I can't help you with that. :(
Title: Re: Help with Help
Post by: marcov on January 26, 2020, 06:35:21 pm
Try to right click the chm, and take the properties.

Is there an "unblock" button there? So yes, press it.
Title: Re: Help with Help
Post by: wp on January 26, 2020, 06:50:01 pm
Can you create a little demo project and associated chm help file and upload them (only .pas, .lfm, .lpr, .lpi and .chm files packed into a common zip)?
Title: Re: Help with Help
Post by: William Marshall on January 30, 2020, 01:25:18 am
My apologies.  I don't mean to be rude and leave this thread hanging, but I'll be quite busy with other matters for a while.  I hope to be able to get back to programming soon.  In the meantime my thanks to everyone for your help and patience.
TinyPortal © 2005-2018