本帖最后由 lchl0588 于 2010-8-1 19:01 编辑
来自某个网页#Include <GuiListView.au3>
$Form1 = GUICreate("AForm1", 452, 199, 177, 118)
$ListView1 = GUICtrlCreateListView("1|2|3", 10, 10, 431, 156)
$ListView1_0 = GUICtrlCreateListViewItem("1", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("item2", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("item3", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("item4", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("item5", $ListView1)
$dd = GUICtrlCreateInput("",10,179)
Global Const $WM_NOTIFY = 0x004E
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
GuiSetState()
Do
Until GUIGetMsg()=-3
Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
Const $NM_FIRST = 0
Const $NM_CLICK = ($NM_FIRST - 2)
Const $NM_HOVER = ($NM_FIRST - 13)
#forceref $hWndGUI, $MsgID, $wParam
Local $tagNMHDR, $event, $hwndFrom, $code
$tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$event = DllStructGetData($tagNMHDR, 3)
If $event = $NM_CLICK Then
GUICtrlSetData($dd,"鼠标选中:"&_GUICtrlListViewGetItemText($ListView1, _GUICtrlListViewGetSelectedIndices($ListView1)))
EndIf
$tagNMHDR = 0
$event = 0
$lParam = 0
EndFunc
看下25行中!!! |