.chm file is not programmatically accessible in SO

2019-09-08 06:22发布

I have built a VS2012 application in VB. RECENTLY, I've found that I'm unable to access a HELP (.chm) file in my app development folder (and, for that matter, several of the folders leading up to that folder). I've now placed a copy of the .chm file in all of the folders forming the path to the app development folder. For reference, the app development folder is:

C:/Users/Gary/My Documents/Visual Studio 2012/Projects/Doctor Doctor/Doctor Doctor/Doctor Doctor/Bin/Debug

Up until a week ago, no problems. Now, strange behavior.

Here's a piece of code that "works" -- meaning that when I run the app and click a menu item (mnuHelp) in the base form, the HELP file shows up, as expected:

Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuHelp.Click
    Dim str As String = "C:/Users/Gary/My Documents/Doctor21.chm"
    Help.ShowHelp(Me, str, System.Windows.Forms.HelpNavigator.KeywordIndex, "Welcome")
End Sub

When I now move "closer" to the app development folder, clicking the menu item results in a brief pause (including an hourglass) shows up for a second or so, but nothing else. The revised code is

Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuHelp.Click
    Dim str As String = "C:/Users/Gary/My Documents/Visual Studio 2012/Doctor21.chm"
    Help.ShowHelp(Me, str, System.Windows.Forms.HelpNavigator.KeywordIndex, "Welcome")
End Sub

Note that the only difference is the inclusion of "Visual Studio 2012" in the path. Copies of the .chm file reside in both the "My Documents" and "Visual Studio 2012" folders. Also, I've followed earlier posts to explicitly include the .chm file within the project, setting Build Action = Content and Copy to Output Directory = Copy if Newer

Any ideas regarding this behavior?

Some added info that MAY be pertinent....the project contains numerous places where HELP can be accessed. ALL of those places (except the one in the base form as shown above), attempt to access HELP in the app folder.

If the base-form HELP fails to access HELP, then ALL places fail to access HELP. If the base-form HELP path is set to a location where the access succeeds, then ALL OTHER places succeed (even though they are implicitly looking for the .chm file in the app folder). For the other places to work, though, I must have first accessed HELP from the base form.

1条回答
放我归山
2楼-- · 2019-09-08 06:45

I tried to reproduce your problem with Visual Studio 2015 - but seems not to happen on my system. Some thoughts - but be careful with the first hint:


The hh.dat file stores user-specific information on all the HTMLHelp files (*.CHM) on your system (position, favourite topics, search history, etc.), and can cause a error if it has somehow been corrupted. Delete or rename the file hh.dat to reset all (!) CHM windows on your system to their default settings. You should find hh.dat in this directory:

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

or (depending on your windows version)

C:\Users\%username%\AppData\Roaming\Microsoft\HTML Help

Windows will create a new version of hh.dat when you next open any .chm file.


You'd check if your CHM was not changed and compiled in a different way. Make sure the same CHM file is in both of your test folders. Search and check if a file e.g doctor21.chw is created on the fly (delete this file in your test folders).


Make sure you have a index tab and a keyword "Welcome" in the CHM's index.

查看更多
登录 后发表回答