oceanwind 发表于 2014-1-19 09:31:51

[已解决][转贴]listbox双击消息

原贴地址http://www.autoitscript.com/forum/topic/5279-simulate-doubleclick-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

joyran 发表于 2014-1-19 10:18:29

谢楼主提供!辛苦
页: [1]
查看完整版本: [已解决][转贴]listbox双击消息