by Anonymous (267 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 23rd December 1998
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Give a window a toolbar style title bar using the SetWindowLong API function
API Declarations
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const WS_EX_TOOLWINDOW = &H80&
Public Const GWL_EXSTYLE = (-20)
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOZORDER = &H4
Public Const SWP_NOSIZE = &H1
Private Sub Form_Load()
Dim xx As Long
xx = GetWindowLong(hwnd, GWL_EXSTYLE)
xx = SetWindowLong(hwnd, GWL_EXSTYLE, _
xx Or WS_EX_TOOLWINDOW)
SetWindowPos hwnd, 0, 0, 0, 0, 0, _
SWP_FRAMECHANGED Or SWP_NOMOVE Or _
SWP_NOZORDER Or SWP_NOSIZE
End Sub
No comments have been posted about Give a window a toolbar style title bar using the SetWindowLong API function. Why not be the first to post a comment about Give a window a toolbar style title bar using the SetWindowLong API function.