|
发表于 2009-2-13 21:25:48
|
显示全部楼层
下面这段代码可以监测ListView是不是被点击
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~ Local $tBuffer
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
ConsoleWrite("A column was clicked" & @LF)
Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
ConsoleWrite("Clicked" & @LF)
Return 0
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY |
|