Open CHM (help file) in C#

Bodo picture Bodo · May 23, 2011 · Viewed 33.5k times · Source

I'm trying to open help file (chm extension) in C#.

File.Open(@"//help.chm",FileMode.Open, FileAccess.Read, FileShare.Read);

and

FileStream fileStream = new FileStream(@"c:\help.chm", FileMode.Open);

doesn't work :(

Answer

abhilash picture abhilash · May 23, 2011

You can use -

System.Windows.Forms.Help.ShowHelp(Control, String)

So assuming you are in a Form/Control

Help.ShowHelp(this, "file://c:\\helpfiles\\help.chm");

ShowHelp method also provides overloads to go to specific topic and help page located inside the compiled HTML help file.

Read System.Windows.Forms.Help.ShowHelp on MSDN

Decompiling a CHM file

Is as easy as executing below command in the command prompt.

hh.exe -decompile <target-folder-for-decompiled-content> <source-chm-file>

For Example:

hh.exe -decompile C:\foo\helpchmextracted help.chm

After executing the above command you should find the decompiled content in the C:\foo\helpchmextracted folder.