Const LVM_GETHEADER = LVM_FIRST + 31
В успешном случае возвращается дескриптор элемента header
' Меняем вид заголовков в ListView на плоский
' По умолчанию используется стиль кнопок
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 Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Const GWL_STYLE = -16
Private Const LVM_FIRST = &H1000
Private Const LVM_GETHEADER = LVM_FIRST + 31
Private Const HDS_BUTTONS = &H2
Private Sub Command1_Click()
Call ToggleHeader(ListView1.hwnd)
End Sub
Public 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