#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test GUI", 400, 400) GUICtrlCreateLabel("ListView 1", 80, 3, 50, 16) $ctlListView_1 = GUICtrlCreateListView("Items|SubItems", 10, 20, 180, 180) GUICtrlCreateLabel("ListView 2", 280, 3, 50, 16) $ctlListView_2 = GUICtrlCreateListView("Items|SubItems", 210, 20, 180, 180) GUICtrlCreateLabel("ListView 3", 180, 220, 50, 16) $ctlListView_3 = GUICtrlCreateListView("Items|SubItems", 10, 240, 380, 140) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $iIDFrom, $iCode $tNMHDR = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code", $lParam) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iCode Case $NM_SETFOCUS Switch $iIDFrom Case $ctlListView_1 ConsoleWrite("ListView 1 was focused" & @LF) Case $ctlListView_2 ConsoleWrite("ListView 2 was focused" & @LF) Case $ctlListView_3 ConsoleWrite("ListView 3 was focused" & @LF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc |