0

I have a C++ program that calls AfxMessageBox, passing in a help file context ID. When I click Help on the resulting message box, I get a litte error box that says "Failed to launch help." I need to verify that I'm using a valid help ID. Is there a way to examine a CHM file to find out what context IDs are valid for it? Either a commercial tool or a way to write a C# or C++ or even Python program to do it.

Edit: This is an old CHM file, and I do not have the files that were used to create it. I used 7-zip to extract its contents into a folder, but I see nothing there that tells me what context IDs the file has. When the error occurs, the C++ code assigns a value of 135 to the error, and then it adds 0x30000 (196,608) to that for no reason I know. Then, when the message box gets generated, 0x30000 is subtracted and the result, 135, is passed in to AfxMessageBox() as the help ID. I've tried both 135 and 196743 (0x30000 + 135) in the AfxMessageBox() call but neither has worked. The files extracted from the help file by 7-Zip include a set of .htm file with numbers for names, but the numbers have no relation to the context IDs that I can find.

There is another execution path in my code that uses the same help file. As near as I can tell, it uses low-level functions to create a dialog box that resembles the output of AfxMessageBox(). When I force that code path use context ID 196743, I get the expected help page. Unfortunately, it's not easy to get from the code that doesn't work to the code that does.

ROBERT RICHARDSON
  • 2,077
  • 4
  • 24
  • 57

1 Answers1

0

Edit:

Your additional Edit in the question take me back many years. Not related to your original question but some links to read:


Extracting help contextID by code you must have deep knowledge of the CHM internals.

For a single value e.g. 10000 you may want to test the contextID using PowerShell or a DOS prompt. This opens the requested .chm in the Help viewer, and uses a context ID to request a URL to display.

hh.exe -mapid 10000 ms-its:CHM-example.chm

Sometimes you only have the CHM output file and nobody can locate the source files. It’s not always possible to recover all files and data you need.

Decompiling loses the alias.h and map.h files and their information for F1-Help (context sensitive help).

You may know a CHM is something like a zipped web (HTML archive) with some additional system files of metadata. Context ID's are mostly integrated by compiling a alias.h and map.h file. The purpose of the two files is to ease the coordination between developer and help author. The mapping file links an ID to the map number - typically this can be easily created by the developer and passed to the help author. Then the help author creates an alias file linking the IDs to the topic names (See: Creating Context-Sensitive Help for Applications.

I'm using FAR HTML as a toolbox full of various authoring, file and HTML utilities (Disclaimer: It is freeware now!).

Please note there is a download link (for required Microsoft HTMLHelp Workshop) because the Microsoft download links are broken.

The CHM can be opened using FAR HTML and by copy and paste you have all ID and topic information (ALIAS section). In Help File Explorer you need to open Internal Files > #IVB.

enter image description here

help-info.de
  • 6,695
  • 16
  • 39
  • 41