Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

QuickQuery Half-Life Edition

Browsing QuickQuery HL Edition/ListViewStylesMod.bas (3.60 KB)

Attribute VB_Name = "ListViewStylesMod"

Private Const LVM_FIRST = &H1000
Private Const LVM_GETHEADER = (LVM_FIRST + 31)
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 55)
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 54)
Private Const LVS_EX_CHECKBOXES = &H4
Private Const LVS_EX_FULLROWSELECT = &H20
Private Const LVS_EX_LABELTIP = &H4000
Private Const LVS_EX_ONECLICKACTIVATE = &H40
Private Const LVS_EX_UNDERLINEHOT = &H800

Private Const HDS_BUTTONS = &H2

Private Const GWL_STYLE = (-16)

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam 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

Public Function LV_CheckBoxes(ListViewObj As ListView) As Long
    LV_CheckBoxes = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) Xor LVS_EX_CHECKBOXES)
End Function

Public Function LV_LabelTip(ListViewObj As ListView) As Long
    LV_LabelTip = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) Xor LVS_EX_LABELTIP)
End Function

Public Function LV_UnderlineHot(ListViewObj As ListView, bUnderlineHot As Boolean) As Long
    If bUnderlineHot Then
        SendMessageLong ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) Or LVS_EX_ONECLICKACTIVATE
        LV_UnderlineHot = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) Or LVS_EX_UNDERLINEHOT)
    Else
        SendMessageLong ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) And Not LVS_EX_ONECLICKACTIVATE
        LV_UnderlineHot = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) And Not LVS_EX_UNDERLINEHOT)
    End If
End Function

Public Function LV_HotTracking(ListViewObj As ListView, bHotTracking As Boolean) As Long
    If bHotTracking Then
        LV_HotTracking = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) Or LVS_EX_ONECLICKACTIVATE)
    Else
        LV_HotTracking = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) And Not LVS_EX_ONECLICKACTIVATE)
    End If
End Function

Public Function LV_FlatColumnHeaders(ListViewObj As ListView) As Long
    LV_FlatColumnHeaders = SetWindowLong(SendMessageLong(ListViewObj.hWnd, LVM_GETHEADER, 0, ByVal 0&), GWL_STYLE, GetWindowLong(SendMessageLong(ListViewObj.hWnd, LVM_GETHEADER, 0, ByVal 0&), GWL_STYLE) Xor HDS_BUTTONS)
End Function
Public Function LV_FullRowSelect(ListViewObj As ListView) As Long
    LV_FullRowSelect = SendMessageLong(ListViewObj.hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, SendMessageLong(ListViewObj.hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&) Xor LVS_EX_FULLROWSELECT)
End Function


Download QuickQuery HL Edition/ListViewStylesMod.bas

Back to file list


Back to project page