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

Last reviewed: February 10, 1998
Article ID: Q180832
The information in this article applies to:
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0
  • Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 32-bit only, for Windows, version 4.0

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. Installing any newer version of comctl32.dll fixes the problem. An updated version of comctl32.dll can be downloaded from the Microsoft Software Library. See the REFERENCES section below 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

  1. Create a Standard EXE on new installation of Windows 95 (without Internet Explorer installed).

  2. Add a reference to the Windows Common Controls.

  3. Add a Toolbar control to Form1.

  4. Add the following code to Form1:

          Private Sub Form_Load()
    
            Dim btnX As Button
            Set btnX = Toolbar1.Buttons.Add(, , "Test", tbrDefault)
          End Sub
    
    

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

REFERENCES

For additional information, refer to the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q167121
   TITLE     : FILE: COMCTLZP.EXE: Comctl32.ocx Updated to Version
               5.00.3828

NOTE: Versions 3.51 and 4.0 of comctl32.dll in Windows NT 3.51 and 4.0, respectively, do not exhibit the problem in Visual Basic 5.0.


Additional query words: visible tool bar comctl32.ocx
Keywords : vb432 VB4WIN vb5all VBKBAX VBKBComp VBKBCtrl
Version : WINDOWS:4.0,5.0
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 10, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.