Microsoft KB Archive/180832

= FIX: Toolbar Buttons Do Not Appear Correctly at Run-time =

Article ID: 180832

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q180832



SYMPTOMS
The toolbar buttons on a Toolbar control do not appear at run-time. With Visual Basic 5.0, a Toolbar control with buttons on it appears as an empty, gray band. With Visual Basic 4.0, the Toolbar buttons appear but the Toolbar is not tall enough to display the captions.



CAUSE
The problem occurs due to a bug in Comctl32.dll version 4.00.950 that ships with Windows 95.



RESOLUTION
Use an ImageList control to add an image to at least one button, and then all the buttons display correctly. To resolve this problem, install any newer version of Comctl32.dll. You can download an updated version of Comctl32.dll from the Microsoft Download Center. See the "References" section for more information.



STATUS
This problem has been corrected in later versions of Comctl32.dll.



MORE INFORMATION
If you do not add any images to your Toolbar buttons, the buttons may not appear at run-time. But, if you add a ToolTip and/or code behind the button's Click Event, these will work properly when the mouse is placed over the button's location. Also, the gray band is taller when a Caption is used.

Steps to Reproduce Behavior
 Create a Standard EXE on new installation of Windows 95 (without Internet Explorer installed). Add a reference to the Windows Common Controls. Add a Toolbar control to Form1.  Add the following code to Form1: Private Sub Form_Load Dim btnX As Button Set btnX = Toolbar1.Buttons.Add(,, "Test", tbrDefault) End Sub

 Run the Project. Note that the Toolbar appears as an empty, gray band across the top of the Form. It should have a single button with "Test" as its Caption.</li></ol>

<div class="references_section">