Open .chm Help File in Windows

To launch my .chm Help file for my Help Contents menu in windows. I’m trying to get the file to open and launch located in my program files location. This should be real easy code but everything I tried from the Xojo Documentation on FolderItems is not working. I know it’s got to be just a couple lines of code. What am I missing here. Can anyone help? Thx

Dim f As FolderItem

f = GetFolderItem(“C\Program Files\MyProgram\Help.chm”)

How about

f = GetFolderItem(“Help.chm”)

By default, GetFolderItem looks in the current directory, which would be where your program is. Also, on a 64-bit system, your program would be installed in “Program Files (64)”, not “Program Files”.

f = GetFolderItem(“C\Program Files\MyProgram\Help.chm”)

  1. Double check the path its missing C:\
  2. are you sure yo want a full & absolute path ?
  3. if so I would also use the form that tells GetFolderitem what path style it is (see getfolderitem in the docs & look at the second parameter)
  4. try tim’s suggestion

Oops, that’s “Program Files (x86)”.

Hi guys, thank you for the fast response. I’m having my setup factory installer put the help file in a folder called Docs. Norman had mentioned path style for the full & absolute path. Would that be as below’s code example.

Dim f As FolderItem

f = GetFolderItem(“C:\Program Files\MyProgram\Docs\Help.chm”, FolderItem.PathTypeAbsolute)

Stay away from absolute paths. For a subfolder, you can use

f = GetFolderItem(“Docs”).Child(“Help.chm”)

Hi Tim

I tried that code with no luck but I think it’s on the right track. Does Windows automatically open the app that displays the help, like the mouse click event does when I click on it. Do I have to tell it in code (Like mouse click event) to find the program from the extension .chm to execute the Help Display Program and open the help file in it.

If f.exists Then
// Open .chm program and display help file
End If

You have to tell it. I have some declares somewhere. I’ll look for them.

That explain’s why, I’ll stand by when you get around to finding the decalares. Thanks so much for your help

Can’t you just use f.launch?

Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (hwnd as Integer, url as CString, command as Integer, data as integer) as Integer

if HTMLHelp(0, f.AbsolutePath, 0, 0)= 0 then return false

Stupid question; can you open the CHM file from the desktop? Win7 and Win8 are pretty “strict” about CHM files.

Thanks Guys for all your help. It worked perfect after I installed it with the installer with the code below. I decided to put the help file in the main program folder instead of a Docs folder inside it, to make it easier.

Dim f As FolderItem

f = GetFolderItem(“GAS.chm”)

If f.Exists Then
f.Launch
Else
MsgBox(“The FolderItem does not exist.”)
End If

Launch works ok. The declare allows you to open the chm at a specific topic.

Have you tried double click ? Opens fine here. Win 8.1.

I know this is a very old thread but how do you do the same but pass the “topic” as a string to ZOOM to that topic in the .chm file.