BUG: General Protection Fault May Occur When the ComboBox Control Is Set on a Band of CoolBar

This article was previously published under Q269618
This article has been archived. It is offered "as is" and will no longer be updated.
If you have a Visual Basic application with a ComboBox control set on a band of the CoolBar control, it works as expected in versions of Visual Basic earlier than Microsoft Visual Studio 6.0 Service Pack 4 (SP4). However, if you are using SP4, the application may stop responding (crash) when the form that hosts the CoolBar control closes. The crash only occurs on systems that are running on Windows 98 or Windows 95.
This behavior occurs because the controls set on the band of CoolBar are not cleared at the correct time.
To work around the problem, add the following line of code to the Form_QueryUnload event handler:
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Steps to Reproduce Behavior

  1. Create a Standard EXE project with Visual Basic from Visual Studio 6.0 SP4 in Windows 98. Form1 is created by default.
  2. On the Components dialog box, press the CTRL+T keys, select Microsoft Windows Common Controls-3 6.0 (Sp4), and then click OK.
  3. Add a CoolBar control to Form1. Use the default settings.
  4. Add a ComboBox control inside one of the bands of the CoolBar control.
  5. Save the project and press the F5 key to run the application. Click the X in the upper-right corner of the form to close the form, and note that an error message similar to the following appears:
    Filename caused a general protection faultin module USER.EXE at 0004:00000499.

    This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.
    The Filename is the name of your project.

  6. Re-open the project inside the Visual Basic integrated development environment (IDE). Sometimes Windows crashes when Visual Basic is re-opened, and you may need to restart your computer. You may also see a "resource is low" message box indicating that you need to shut down other applications or drivers running in the background.
  7. Add the following code to Form1:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)    CoolBar1.Bands.ClearEnd Sub						
  8. Save the project and press F5 to run the application. Click the X in the upper-right corner of the form to close the form, and note that the project works fine.

    NOTE: If you click the End button in the Visual Basic IDE to end the application, note that you continue to see the problem because the Form_QueryUnload event handler does not have a chance to run. Therefore, do not end your application by using the End button in the IDE. To work around this problem, you can replace the SP4 version of the Comct332.ocx file in the system directory with the Visual Studio 6.0 Service Pack 3 version. You still need to implement the workaround mentioned in last step at the same time.
For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
189632 BUG: Error in CoolBar Event Can Cause Hanging or Exception
189914 BUG: Wrapped CoolBar Control May GPF Client EXE Program
257630 FIX: Exception Error Closing an Application Containing a CoolBar Control
Comct332 gpf halts halt

Article ID: 269618 - Last Review: 02/28/2014 04:20:03 - Revision: 2.0

Microsoft Visual Basic 6.0 Professional Edition, Microsoft Visual Basic 6.0 Enterprise Edition

  • kbnosurvey kbarchive kbbug kbfix kbvs600sp5fix KB269618