Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $List
$hWndListView = $ListView1
If Not IsHWnd($ListView2) Then $hWndListView = GUICtrlGetHandle($ListView2)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $NM_RCLICK
ConsoleWrite("Right click at listview")
;ListView_RClick()
Return 0
Case $NM_CLICK ; 左击
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$Index = DllStructGetData($tInfo, "Index")
$subitemNR = DllStructGetData($tInfo, "SubItem")
ConsoleWrite("Double click at item index: " & $Index & @CRLF)
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$Index = DllStructGetData($tInfo, "Index")
$subitemNR = DllStructGetData($tInfo, "SubItem")
ConsoleWrite("Double click at item index: " & $Index & @CRLF)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
这个貌似可以 用原理没研究清楚 |