Recent

Author Topic: Help with Help  (Read 2055 times)

William Marshall

  • Jr. Member
  • **
  • Posts: 52
Help with Help
« 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?
Lazarus 1.8.0; fpc 3.0.4; Windows 10

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Help with Help
« Reply #1 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

William Marshall

  • Jr. Member
  • **
  • Posts: 52
Re: Help with Help
« Reply #2 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"?
Lazarus 1.8.0; fpc 3.0.4; Windows 10

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: Help with Help
« Reply #3 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.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Help with Help
« Reply #4 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';

William Marshall

  • Jr. Member
  • **
  • Posts: 52
Re: Help with Help
« Reply #5 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?
Lazarus 1.8.0; fpc 3.0.4; Windows 10

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Help with Help
« Reply #6 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. :(
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Help with Help
« Reply #7 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.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Help with Help
« Reply #8 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)?

William Marshall

  • Jr. Member
  • **
  • Posts: 52
Re: Help with Help
« Reply #9 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.
Lazarus 1.8.0; fpc 3.0.4; Windows 10

 

TinyPortal © 2005-2018