dcsimg
March 26, 2017
Hot Topics:

VB TIP: Using Header Track Selection in a Listview

  • November 18, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »
Public Declare Function SendMessageByLong _
     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 GetWindowLong _
    Lib "user32" _
 Alias "GetWindowLongA" (ByVal hwnd As Long, _
                 ByVal nIndex As Long) As Long

Public Declare Function SetWindowLong _
   Lib "user32" _
 Alias "SetWindowLongA" (ByVal hwnd As Long, _
              ByVal nIndex As Long, _
              ByVal dwNewLong As Long) As Long

Public Const LVM_FIRST As Long = &H1000
Public Const LVM_GETHEADER = (LVM_FIRST + 31)
Public Const GWL_STYLE = -16&
Public Const HDS_HOTTRACK = &H4

Private Sub HeaderTrackSelect(lv As ListView)
    Dim lngHwnd As Long
    Dim lngStyle As Long

    lngHwnd = SendMessageByLong(lv.hwnd, _
                                LVM_GETHEADER, _
                                0, 0)
    If lngHwnd <> 0 Then
        lngStyle = GetWindowLong(lngHwnd, GWL_STYLE)
        lngStyle = lngStyle Or HDS_HOTTRACK
        SetWindowLong lngHwnd, GWL_STYLE, lngStyle
    End If
End Sub





Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel