by Sam Huggill (7 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 2nd June 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Makes the toolbar control flat, like IE4.
API Declarations
Public Const WM_USER = &H400
Public Const TB_SETSTYLE = WM_USER + 56
Public Const TB_GETSTYLE = WM_USER + 57
Public Const TBSTYLE_FLAT = &H800
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
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
Dim style As Long
Dim hToolbar As Long
Dim r As Long
'get the handle of the toolbar
hToolbar = FindWindowEx(Toolbar1.hwnd, 0&, "ToolbarWindow32", vbNullString)
'retreive the toolbar styles
style = SendMessageLong(hToolbar, TB_GETSTYLE, 0&, 0&)
'Set the new style flag
If style And TBSTYLE_FLAT Then
style = style Xor TBSTYLE_FLAT
Else
style = style Or TBSTYLE_FLAT
End If
'apply the new style to the toolbar
r = SendMessageLong(hToolbar, TB_SETSTYLE, 0, style)
End Sub