user3000的码~ 我给转下~~ 善用搜索#include <WinAPIex.au3>
#include <apiconstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Label控件测试", 300, 152)
$Label1 = GUICtrlCreateLabel("标签1", 110, 25, 97, 33, $SS_CENTER)
GUICtrlSetFont(-1, 20)
$handle = DllCallbackRegister("_lable_events", "ptr", "hwnd;uint;long;ptr")
$handle2 = _WinAPI_SetWindowLong(GUICtrlGetHandle($Label1), $GWL_WNDPROC, DllCallbackGetPtr($handle))
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $Label1
;MsgBox(0, "测试", "左键点击")
Case -3 ; $GUI_EVENT_CLOSE
GUIDelete()
DllCallbackFree($handle) ; 必须释放否则程序不会退出
Exit
EndSwitch
WEnd
Func _lable_events($hWnd, $uiMsg, $wParam, $lParam)
Switch $uiMsg
Case $WM_LBUTTONDBLCLK ; 左键双击
MsgBox(64, "提示", "双击了LABLE!")
Case $WM_RBUTTONDOWN ; 右键按下
MsgBox(64, "提示", "右击了LABLE!")
EndSwitch
Return _WinAPI_CallWindowProc($handle2, $hWnd, $uiMsg, $wParam, $lParam)
EndFunc ;==>_lable_events
|