I think the title says it all, so stop talking, let's start coding. :wink:
This is how far I got before I got stuck:
; Create GUI incl. ListView (3 columns) Gui Add, ListView, w400 r10 Checked HwndMyListViewHandle vMyListView,Filename|Extension|Size LV_ModifyCol(1,200) LV_ModifyCol(2,"70") LV_ModifyCol(3,"70 Integer") Gui Add, Button, x300 +Default gLeave, Leave Gui Show,,Group View Test ; Adding files Loop %temp%\*,0 { SplitPath A_LoopFileName,,,,NameWithoutExt LV_Add(""" " . DefaultCheck . " """,NameWithoutExt,A_LoopFileExt,A_LoopFileSize) } ;Sleep 500 ; <- allows visual control before... ;-------------------- ; Creating two Groups ;==================== ; Messages needed LVM_INSERTGROUP = 0x1091 LVM_SETITEM = 0x1006 LVM_ENABLEGROUPVIEW = 0x109d ; LVGROUP structure LVGROUP_CbSize = 0 LVGROUP_Mask = 4 LVGROUP_PszHeader = 8 LVGROUP_CchHeader = 12 LVGROUP_PszFooter = 16 LVGROUP_CchFooter = 20 LVGROUP_IGroupId = 24 LVGROUP_StateMask = 28 LVGROUP_State = 32 LVGROUP_UAlign = 36 LVGROUP_PszSubtitle = 40 LVGROUP_CchSubtitle = 44 LVGROUP_PszTask = 48 LVGROUP_CchTask = 52 LVGROUP_PszDescriptionTop = 56 LVGROUP_CchDescriptionTop = 60 LVGROUP_PszDescriptionBottom= 64 LVGROUP_CchDescriptionBottom= 68 LVGROUP_ITitleImage = 72 LVGROUP_IExtendedImage = 76 LVGROUP_IFirstItem = 80 LVGROUP_CItems = 84 LVGROUP_PszSubsetTitle = 88 LVGROUP_CchSubsetTitle = 92 ; Unicoded Header VarSetCapacity(UnicodeHeader,100) ; Create Group #1 HeadertextGroup1=Group #1 VarSetCapacity(LVGroup1, 96, 0) NumPut(96, &LVGroup1, LVGROUP_CbSize,"Int") NumPut(0x11, &LVGroup1, LVGROUP_Mask,"Int") ; Members we want to set: LVGF_HEADER (flag 0x1) + LVGF_GROUPID (flag 0x10) DllCall("MultiByteToWideChar","UINT",0,"UINT",0,"UINT",&HeadertextGroup1,"INT",-1,"UINT",&UnicodeHeader,"INT",strlen(HeadertextGroup1)+1) NumPut(&UnicodeHeader, &LVGroup1, LVGROUP_PszHeader,"Int") NumPut(0, &LVGroup1, LVGROUP_IGroupId,"Int") SendMessage LVM_INSERTGROUP, -1, &LVGroup1,, ahk_id %MyListViewHandle% ; Create Group #2 (basically the same as above, but with IGroupId +1) HeadertextGroup2=Group #2 VarSetCapacity(LVGroup2, 96, 0) NumPut(96, &LVGroup2, LVGROUP_CbSize, "Int") NumPut(0x11, &LVGroup2,LVGROUP_Mask, "Int") DllCall("MultiByteToWideChar","UINT",0,"UINT",0,"UINT",&HeadertextGroup2,"INT",-1,"UINT",&UnicodeHeader,"INT",strlen(HeadertextGroup2)+1) NumPut(&UnicodeHeader, &LVGroup2,LVGROUP_PszHeader, "Int") NumPut(1, &LVGroup2, LVGROUP_IGroupId, "Int") SendMessage LVM_INSERTGROUP, -1, &LVGroup2,,ahk_id %MyListViewHandle% ;Adding items to the groups ;========================== ; AutoHotkey has no build-in support for Group View, however, it's possible to assign the already imported items manually to the groups ; by subsequently setting the iGroupId member of the items LVITEM structure: LVITEM_mask = 0 LVITEM_iItem = 4 LVITEM_iSubItem = 8 LVITEM_state = 16 LVITEM_stateMask = 20 LVITEM_pszText = 24 LVITEM_cchTextMax = 28 LVITEM_iImage = 32 LVITEM_lParam = 36 LVITEM_iIndent = 40 LVITEM_iGroupId = 44 LVITEM_cColumns = 48 LVITEM_puColumns = 52 LVITEM_piColFmt = 56 LVITEM_iGroup = 60 VarSetCapacity(LVItem5, 64, 0) NumPut(0x100, &LVItem5, 0,"Int") ; Member we want to set: LVIF_GROUPID (flag 0x100) NumPut(5, &LVItem5, LVITEM_iItem,"Int") ; Assign item #5 to ... NumPut(0, &LVItem5, LVITEM_iGroupId,"Int") ; ... group #1 SendMessage LVM_SETITEM, -1, &LVItem,, ahk_id %MyListViewHandle% ; Do it VarSetCapacity(LVItem6, 64, 0) NumPut(0x100, &LVItem6, 0,"Int") NumPut(6, &LVItem6, LVITEM_iItem,"Int") ; Same with item #6 NumPut(0, &LVItem6, LVITEM_iGroupId,"Int") SendMessage LVM_SETITEM, -1, &LVItem6,,ahk_id %MyListViewHandle% VarSetCapacity(LVItem7, 64, 0) NumPut(0x100, &LVItem7, 0,"Int") NumPut(7, &LVItem7, LVITEM_iItem,"Int") ; Item #7 into... NumPut(1, &LVItem7, LVITEM_iGroupId,"Int") ; ... group #2 SendMessage LVM_SETITEM, -1, &LVItem7,,ahk_id %MyListViewHandle% ; Enable Group View (this hides all items which are not assigned to a group!) SendMessage LVM_ENABLEGROUPVIEW,1,0,,ahk_id %MyListViewHandle% Winset Redraw ; not needed on my system, just for being sure Exit GuiClose: GuiEscape: Leave: ExitApp
... and that's the unpleasant outcome: The second group does not appear.
In addition to that, the column headers loose the sorting capability..
I'm not very familiar with this whole API-stuff, so I pin all my hopes on your experience to help me get this thing off the hook .