sensalim Posted April 26, 2008 Share Posted April 26, 2008 Looked at help, it says Enables a button to send BN_KILLFOCUS and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style. To get BN_DBLCLK notification messages, the button must have the BS_RADIOBUTTON or BS_OWNERDRAW style. Then I looked at GUIRegisterMsg() and I got lost. Anyone got a quick simple example? I prefer right click actually... Thank you! Link to comment Share on other sites More sharing options...
rasim Posted April 27, 2008 Share Posted April 27, 2008 (edited) Hi! Try this: expandcollapse popup#include <GuiConstants.au3> #include <Misc.au3> #include <WinAPI.au3> Global Const $BN_CLICKED = 0 Global Const $BN_DBLCLK = 5 Global $DllHandle = DllOpen("user32.dll") $hGui = GUICreate("Double Click Demo", 400, 300) $button = GUICtrlCreateButton("start", 10, 10, 50, 25, $BS_NOTIFY) $aBtnPos = ControlGetPos($hGui, "", $button) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUISetState() While GUIGetMsg() <> -3 If _IsPressed("02", $DllHandle) Then $tPoint = _WinAPI_GetMousePos(True, $hGui) $X = DllStructGetData($tPoint, "X") $Y = DllStructGetData($tPoint, "Y") If ($X >= $aBtnPos[0]) And ($X <= $aBtnPos[0] + $aBtnPos[2]) _ And ($Y >= $aBtnPos[1]) And ($Y <= $aBtnPos[1] + $aBtnPos[3]) Then _DebugPrint("Right mouse click", @ScriptLineNumber) Sleep(100) EndIf WEnd DllClose($DllHandle) Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) ;HiWord $nID = BitAnd($wParam, 0x0000FFFF) ;LoWord If $nID = $button Then Switch $nNotifyCode Case $BN_CLICKED _DebugPrint("Left mouse click", @ScriptLineNumber) Case $BN_DBLCLK _DebugPrint("Left mouse double click", @ScriptLineNumber) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite("+=====================================" & @LF & _ "--> Script Line (" & $line & "):" & @LF & "!" & @TAB & $s_text & @LF & _ "+=====================================" & @LF) EndFunc Edited April 27, 2008 by rasim Link to comment Share on other sites More sharing options...
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