rasim Posted December 9, 2007 Posted December 9, 2007 How can processing double click on Label control? I tryed with this code, but futile : #include <GuiConstants.au3> $hGui = GUICreate("Test", 200, 100) $label = GUICtrlCreateLabel("Click", 70, 45, 50, 17) GUICtrlSetBkColor(-1, 0xFFFF00) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_COMMAND($hWnd, $MsgID, $wParam, $lParam) MsgBox(0, "", "") Local $tagNMHDR, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return 0 $code = DllStructGetData($tagNMHDR, 3) If $wParam = $label And $code = $NM_DBLCLK Then MsgBox(0, "Ok", "Double click") Return $GUI_RUNDEFMSG EndFunc
smashly Posted December 9, 2007 Posted December 9, 2007 (edited) Hi, you could make it a bit tidier but it's something like this.. #include <GuiConstants.au3> Global $label, $DoubleClick $hGui = GUICreate("Test", 200, 100) $label = GUICtrlCreateLabel("Click", 70, 45, 50, 17) GUICtrlSetBkColor(-1, 0xFFFF00) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If $DoubleClick = 1 Then $DoubleClick = 0 MsgBox(0, "Ok", "Double click") EndIf WEnd Func WM_COMMAND($hWnd, $MsgID, $wParam, $lParam) Local Const $STN_DBLCLK = 1 Local $nID = BitAND($wParam, 0xFFFF) Local $nNotifyCode = BitShift($wParam, 16) If $nID = $label And $nNotifyCode = $STN_DBLCLK Then $DoubleClick = 1 Return $GUI_RUNDEFMSG EndFunc Cheers Edited December 9, 2007 by smashly
rasim Posted December 9, 2007 Author Posted December 9, 2007 smashlyNice example, thanks, but where you take this code?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now