***************************************************************
*  Go to Dragon's VB Code Corner for more useful sourcecode:  *
*  http://personal.inet.fi/cool/dragon/vb/                    *
***************************************************************

Author: Vinnie Murdico <swbrains@monmouth.com>

This code shows how to change a VB toolbar control so that
it looks like the IE style toolbar, with 'flat' buttons.

Call the function like this:

   Call MakeToolbarFlat(myToolbar)

myToolbar is, of course, the name of your toolbar control.

Paste the following code into a module:
'//*********************************//'

Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendTBMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long

Public Const WM_USER = &H400
Public Const TBSTYLE_FLAT = &H800
Public Const TBSTYLE_TRANSPARENT = &H8000
Public Const TB_SETSTYLE = (WM_USER + 56)
Public Const TB_GETSTYLE = (WM_USER + 57)

Public Sub MakeToolbarFlat(theToolbar As Control)

    Dim Res As Long
    Dim Style As Long

    Style = SendTBMessage(FindWindowEx(theToolbar.hwnd, 0&, "ToolbarWindow32", vbNullString), TB_GETSTYLE, 0&, 0&)
    Style = Style Or TBSTYLE_FLAT Or TBSTYLE_TRANSPARENT
    Res = SendTBMessage(FindWindowEx(theToolbar.hwnd, 0&, "ToolbarWindow32", vbNullString), TB_SETSTYLE, 0, Style)

    theToolbar.Refresh

End Sub
