Info Posted August 27, 2009 Share Posted August 27, 2009 (edited) ? Edited August 27, 2009 by Info Link to comment Share on other sites More sharing options...
Authenticity Posted August 27, 2009 Share Posted August 27, 2009 expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) If Not IsDeclared('WM_LBUTTONDBLCLK') Then Global Const $WM_LBUTTONDBLCLK = 0x0203 Global $hGUI, $Button, $Edit, $Label Global $aWndProcs[4][2] = [[0]], $hProc, $pProc Global $fDouble = False $hGUI = GUICreate('Test', 200, 400) $hProc = DllCallbackRegister('_Handler', 'lresult', 'hwnd;uint;wparam;lparam') $pProc = DllCallbackGetPtr($hProc) $Button = GUICtrlCreateButton('&Click', 65, 360, 70, 25) _InstallControlProcedure($Button, $pProc) $Edit = GUICtrlCreateEdit('', 10, 10, 180, 280) _InstallControlProcedure($Edit, $pProc) $Label = GUICtrlCreateLabel('This also', 65, 320, 70, 25, $SS_CENTER) _InstallControlProcedure($Label, $pProc) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() DllCallbackFree($hProc) Exit Func _Handler($hWnd, $iMsg, $iwParam, $ilParam) Local $iIndex = 0 For $i = 1 To $aWndProcs[0][0] If $hWnd = $aWndProcs[$i][0] Then $iIndex = $i ExitLoop EndIf Next If $iMsg = $WM_LBUTTONDBLCLK Then Switch _WinAPI_GetDlgCtrlID($hWnd) Case $Button MsgBox(0x40, 'Button', 'Double Click') Case $Edit MsgBox(0x40, 'Edit', 'Double Click') Case $Label MsgBox(0x40, 'Label', 'Double Click') EndSwitch EndIf Return _WinAPI_CallWindowProc($aWndProcs[$iIndex][1], $hWnd, $iMsg, $iwParam, $ilParam) EndFunc Func _InstallControlProcedure($hControl, $pProc) If Not IsHWnd($hControl) Then $hControl = GUICtrlGetHandle($hControl) If Not IsHWnd($hControl) Then Return SetError(1, 0, 0) EndIf $aWndProcs[0][0] += 1 $aWndProcs[$aWndProcs[0][0]][0] = $hControl $aWndProcs[$aWndProcs[0][0]][1] = _WinAPI_SetWindowLong($hControl, $GWL_WNDPROC, $pProc) Return True EndFunc 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