原贴地址http://www.autoitscript.com/foru ... leclick-in-listbox/
在中文件论坛上我是没有搜到相关贴子 在英文官网上一搜就有了
list,listbox双击消息通用.#include "GUIConstants.au3"
Global Const $WM_COMMAND = 0x0111
Global Const $LBN_SELCHANGE = 1
Global Const $LBN_DBLCLK = 2
Dim $Lastselected = ""
GUICreate("SomeGUI")
$test1 = GUICtrlCreateList ("" , 10, 10,150,350 )
$test2 = GUICtrlCreateList ("" , 170, 10,150,350 )
GuiCtrlSetData($test1, "1|2|3|4|5" )
$info = GUICtrlCreateLabel("", 10, 360, 200, 20)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GuiSetState ()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $test1
$Selected = GUICtrlRead ( $test1 )
GUICtrlSetData($info, "Currently selected: " & $Selected)
EndSelect
Wend
Exit
Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
$nNotifyCode = BitShift($wParam, 16)
$nID = BitAnd($wParam, 0x0000FFFF)
$hCtrl = $lParam
If $nID = $test1 Then
Switch $nNotifyCode
Case $LBN_DBLCLK
$Selected = GUICtrlRead ($test1)
GuiCtrlSetData($test2, $Selected)
Return 0
EndSwitch
EndIf
EndFunc
|