Microsoft KB Archive/269618

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

Article ID: 269618

Article Last Modified on 5/12/2003

-

APPLIES TO

 Microsoft Visual Basic 6.0 Professional Edition, when used with:  Microsoft Windows 95

 Microsoft Windows 98 Standard Edition

 Microsoft Windows NT 4.0

 Microsoft Windows 2000 Standard Edition</li></ul>

 Microsoft Windows XP Professional</li></ul> </li> Microsoft Visual Basic 6.0 Enterprise Edition, when used with:  Microsoft Windows 95</li></ul>

 Microsoft Windows 98 Standard Edition</li></ul>

 Microsoft Windows NT 4.0</li></ul>

 Microsoft Windows 2000 Standard Edition</li></ul>

 Microsoft Windows XP Professional</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q269618

<div class="symptoms_section">

SYMPTOMS
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.

<div class="cause_section">

CAUSE
This behavior occurs because the controls set on the band of CoolBar are not cleared at the correct time.

<div class="resolution_section">

RESOLUTION
To work around the problem, add the following line of code to the Form_QueryUnload event handler: CoolBarName.Bands.Clear

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce Behavior
<ol> Create a Standard EXE project with Visual Basic from Visual Studio 6.0 SP4 in Windows 98. Form1 is created by default.</li> On the Components dialog box, press the CTRL+T keys, select Microsoft Windows Common Controls-3 6.0 (Sp4), and then click OK.</li> Add a CoolBar control to Form1. Use the default settings.</li> <li>Add a ComboBox control inside one of the bands of the CoolBar control.</li> <li>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 fault in 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.

</li> <li>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 &quot;resource is low&quot; message box indicating that you need to shut down other applications or drivers running in the background.</li> <li>Add the following code to Form1:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) CoolBar1.Bands.Clear End Sub

</li> <li>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.</li></ol>

<div class="references_section">