BUG: Visual Basic Application Using HtmlHelp API Crashes

ID: Q244140


The information in this article applies to:
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0


SYMPTOMS

A Visual Basic application running in the IDE uses the HtmlHelp function to display a Help window. When the calling form is closed or the project is stopped, a fatal error occurs. Under Windows NT, the Visual Basic design environment shuts down with no message. Under Windows 9x, an IPF or access violation occurs. This problem does not occur in a compiled application.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Visual Basic Standard EXE project. Form1 is created by default.


  2. Add a CommandButton to Form1.


  3. Add the following code to the General Declarations section of Form1:


  4. 
    Option Explicit
    
    Private Declare Function HtmlHelp Lib "hhctrl.ocx" _
            Alias "HtmlHelpA" _
            (ByVal hwndCaller As Long, _
            ByVal pszFile As String, _
            ByVal uCommand As Long, _
            ByVal dwData As Long) _
            As Long
    
    Private Const HH_DISPLAY_TOPIC = &H0
    Private Const HH_CLOSE_ALL = &H12
    
    Private Sub Command1_Click()
       Call HtmlHelp(Me.hWnd, "IEXPLORE.CHM", _
                           HH_DISPLAY_TOPIC, 0)
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    '   Call HtmlHelp(Me.hWnd, "", HH_CLOSE_ALL, 0)
    End Sub 
  5. Run the project, and click on Command1.


  6. Leave the Help window open, but close Form1 or stop the project.


  7. On Windows 9x Visual Basic closes. On Windows NT, you should see an access violation.


WORKAROUND

Remove the comment symbol (') from the line of code in the Form_Unload event and run the application again. The problem no longer occurs.

Additional query words:

Keywords : kbHTMLHelp kbVBp kbVBp500bug kbVBp600bug kbIDEProject kbGrpVB kbDSupport
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: October 27, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.