PRB: Common Dialog ShowHelp Method does not Work with CHM Files (233398)



The information in this article applies to:

  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

This article was previously published under Q233398

SYMPTOMS

When attempting to display a Help file using the Microsoft Common Dialog Control 6.0, the following error message is displayed:
The filename file is not a Windows Help file, or the file is corrupted.

CAUSE

The ShowHelp method launches WinHelp32.exe, which does not support HTML based help files.

RESOLUTION

To open an HTML based help file from Visual Basic it is necessary to call the HtmlHelp API function.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open a new Visual Basic Standard EXE project. Form1 is created by default.
  2. From the Project menu, choose Components and then select "Microsoft Common Dialog Control 6.0". Next, click OK.
  3. Site a Common Dialog control on Form1.
  4. Add the following code to the General Declarations section of Form1:
       Private Sub Form_DblClick()
          CommonDialog1.HelpFile = "c:\winnt\help\vbsetup.chm"
          CommonDialog1.HelpCommand = cdlHelpContents
          CommonDialog1.ShowHelp
       End Sub
    						
  5. Modify the path and file name in the second line of code to point to an existing .chm file on your system.
  6. Run the application and double-click Form1. The error message described in the SYMPTOMS section occurs.

REFERENCES

Visual Basic Online Help; search on: "ShowHelp" For more information, please see the following article in the Microsoft Knowledge Base:

183434: HOWTO: Use HTML Help API in a Visual Basic Application


Modification Type:MajorLast Reviewed:5/13/2003
Keywords:kbCmnDlg kbprb KB233398