Pourquoi l'exemple de _GUICtrlListView_Create alors qu'il y'en a déjà un pour _GUICtrlHeader_Create!
En effet, c'est un peut plus compliqué! mais j'y arrive!
Voici mon embryon de solution (je n'y ai laisser que la gestion du simple clique)
Code : Tout sélectionner
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiHeader.au3>
#Include <GuiImageList.au3>
#region - GUI Create
$gui = GUICreate('Test',400,300)
$hHeader = _GUICtrlHeader_Create($gui, BitOR($HDS_BUTTONS, $HDS_HOTTRACK))
GUISetState()
#endregion
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hImgList = _GUIImageList_Create(16, 16, 5, 0, 1, 10)
_GUIImageList_AddIcon($hImgList, @SystemDir & "\shell32.dll", 238)
_GUIImageList_AddIcon($hImgList, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImgList, @SystemDir & "\shell32.dll", 160)
_GUICtrlHeader_SetImageList($hHeader, $hImgList)
_GUICtrlHeader_AddItem($hHeader, "Refresh", 100, 2, 0)
_GUICtrlHeader_AddItem($hHeader, "Disconnect", 100, 2, 1)
_GUICtrlHeader_AddItem($hHeader, "Identify", 100, 2, 2)
#region - GUI SelectLoop
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
#endregion
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode
Local $tNMHDR, $tNMHEADER, $tNMHDFILTERBTNCLICK, $tNMHDDISPINFO
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hHeader
Switch $iCode
Case $HDN_ITEMCLICK, $HDN_ITEMCLICKW ; Notifies a header control's parent window that the user clicked the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint