CHM compiles fine, but won't open

3.4k Views Asked by At

I use a program that spits out HTML and hhp projects containing data from my databases. I then compile that hhp with Microsoft HTML Help Compiler (hhc.exe).

It works well, but unfortunately for few projects, hhc compiles fine, but chm file is unusable. It reports "Cannot open the file: mk:@MSITStore‎: FileName"

I have no problem with other chm files on my system. I have no problems with other chm I compile. If I remove several topics from my project produced file works again. It doesn't matter what topics I remove. Files that don't work are almost twice the size of files that work, even tho the html and project file is almost the same (very few changes), which leads me to think compression fails silently if size or structure of some file isn't right.

Does anyone have experience like this and what could be the reason? For those that want to see example, this project will compile and work fine:

Working chm project

And this one compile but fail to open:

Chm that fails

4

There are 4 best solutions below

2
On

I experienced the identical problem. The CHM was double the usual size and could not be opened. The CHM compiler did not report any error. Removing any random HTML file enabled opening the CHM. I generated many other CHMs on the same day, and all the others were OK.

I worked around the problem in the following way:

  1. I added a very small HTML file to the project. It is a copy of one of the other files in the project, so if a user finds it in a search, it does no harm.
  2. I entered the file name in the HHP.
  3. I recompiled the project in the CHM compiler.

The CHM shrank to the normal size, and it opens normally.

1
On

There are a number of reasons why the MS HH compiler may crash.

(1) Invalid filenamesfile and file The HTML Help compiler does not like some filenames e.g. spaces in a filename can still cause some minor problems with HTML Help. Best to replace spaces with underscores. Avoid "#" in file and folder names. Try and stick with these characters _, a..z, A..Z, 0..9.

Do not use periods apart from in the normal file extension. Example: A filename such as xxx.h001.gif is identified incorrectly as a HTML file. The compiler then attempts to parse the binary file and crashes. Do not use file or folder names containing ".chm".

(2) Avoid compiling on a network drive and try to compile on local drive.

(3) Use MJ’s Help Diagnostics to ensure that all the help viewer components are properly installed and registered.

(4) Delete the file “hh.dat”, which you should find in this subdirectory:

\Documents and Settings\%username%\Application Data\Microsoft\HTML Help

This file stores information about all the HTML Help files on your system (Favorites, window size and position, etc.), and can cause the files to misbehave if it has somehow been corrupted.

(5) You need to debug your help system. You need to identify the file(s) that are crashing the compiler.

I normally remove sections of the web by renaming or moving folders and files, then recompile. Keep adding and removing sections until the compiler does not crash. Eventually you will find one or two files that are causing the problem. You may also need to debug these files by temporarily removing sections of the HTML file.

0
On

I see 0 byte files in the input? Maybe the compiler can't handle that?

2
On

I had exactly the same problem and can say it's all a matter of size and most likely an error in the compression module of hhc.

When I added some lines of documentation the size of the CHM-file increased from 1.6 to 3.1 MB and it could not be opened anymore.

This problem could not only be fixed by removing files but also by adding files.

So I wrote some additional documentation, added it to the project and everything was fine again.