Private Declare Function GetWindowLong Lib _
"user32" Alias "GetWindowLongA" (ByVal hWnd _
As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib _
"user32" Alias "SetWindowLongA" (ByVal hWnd _
As Long, ByVal nIndex As Long, ByVal _
dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const LVM_FIRST = &H1000
Private Const LVM_GETHEADER = (LVM_FIRST + 31)
Private Const HDS_BUTTONS = &H2
Call ToggleHeader(ListView1.hWnd)
Private Sub ToggleHeader(lsvhWnd As Long)
Dim hHeader As Long, lStyle As Long
hHeader = SendMessage(lsvhWnd, _
LVM_GETHEADER, 0, ByVal 0&)
lStyle = GetWindowLong(hHeader, GWL_STYLE)
SetWindowLong hHeader, GWL_STYLE, lStyle Xor _
HDS_BUTTONS
End Sub