停止倒计时
创建了一个ListView列表,如何判断点击了列表中的任意一行,则停止倒计时 下面这段代码可以监测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 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
这些是什么意思?
点击其中的一行就停止计时,AdlibDisable()要放在哪里? Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
ConsoleWrite("Clicked" & @LF)
AdlibDisable()
Return 0 原帖由 xinlu8439 于 2009-2-13 23:02 发表 http://autoitx.com/images/common/back.gif
Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
ConsoleWrite("Clicked" & @LF)
...
没用,倒计时还是不会停止 你在DeBug模式下运行,点击ListView内容的时候有没有看见Clicked显示在下面的信息栏?如果有,那是你原来代码的问题,如果没有,那是你没有注册WM_NOTIFY成功 你把
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
换成
Case $LVN_ITEMCHANGED ; An item has changed
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
页:
[1]