本帖最后由 水木子 于 2018-10-17 11:25 编辑
#include <WinAPIex.au3>
#include <WindowsConstants.au3>
GUICreate('', 400, 300)
$Button1 = GUICtrlCreateButton('Button1', 100, 100, 200, 50)
$handle1 = DllCallbackRegister('_Button_Events', 'ptr', 'hwnd;uint;long;ptr')
$handle2 = _WinAPI_SetWindowLong(GUICtrlGetHandle($Button1), $GWL_WNDPROC, DllCallbackGetPtr($handle1))
GUISetState()
While 1
Switch GUIGetMsg()
Case $Button1
;MsgBox(0, '测试', '左键点击')
Case -3
GUIDelete()
DllCallbackFree($handle1)
Exit
EndSwitch
WEnd
Func _Button_Events($hWnd, $uiMsg, $wParam, $lParam)
Switch $uiMsg
Case $WM_LBUTTONDBLCLK ; 左键双击
MsgBox(0, '', '你双击了button1')
Case $WM_RBUTTONDOWN ; 右键按下
MsgBox(64, '', '鼠标右键点击')
EndSwitch
Return _WinAPI_CallWindowProc($handle2, $hWnd, $uiMsg, $wParam, $lParam)
EndFunc ;==>_Button_Events
|