Hello

For aesthetic reasons, the listviews in my program are made to look flat, and I had to use custom API calls to do that, because the "flat appearance" property in VB6 does not work.

Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
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

Public Sub flattenLvHeader(ByRef lv As Object)
   ' hSysHeader = FindWindowEx(lv.hWnd, 0, "SysHeader32", vbNullString) ' For VB5 listviews
   hSysHeader = FindWindowEx(lv.hWnd, 0, "msvb_lib_header", vbNullString) ' For VB6 listviews
   SetWindowLong hSysHeader, GWL_STYLE, GetWindowLong(hSysHeader, GWL_STYLE) And Not HDS_BUTTONS
End Sub

(...)

Call flattenLvHeader(ListView1)
However, that prevents the event from firing when the user clicks on a listview header, and I need that event to let the user sort the listview by clicking a column header.

Does anyone know how to make a listview look flat so that clicking on the column header still fires an event?