GUIGetCursorInfo的问题
本帖最后由 omegabomb 于 2009-8-11 12:05 编辑#include<GUIConstants.au3>
$Main=GUICreate("GUI",200,100)
$Menu=GUICtrlCreateMenu("&File")
$New=GUICtrlCreateMenuItem("&New",$Menu)
$button=GUICtrlCreateButton("Btn",20,20,60,20)
GUISetState()
While 1
$Curinfo=GUIGetCursorInfo($Main)
If $Curinfo=1 And $Curinfo=$button Then
MsgBox(0,"","Btn")
EndIf
If $Curinfo=1 And $Curinfo=$New Then
MsgBox(0,"","New")
EndIf
WEnd右键点击“Btn”会弹出MsgBox,而右键点击“New”,则没反应,为什么呢? 似乎菜单不支持右键 :face (30): 注册消息吧...
$WM_MENURBUTTONUP = 0x122
$hGUI = GUICreate("WM_MENURBUTTONUP", 200, 100)
$iMenu = GUICtrlCreateMenu("Edit")
GUICtrlCreateMenuItem("Replace", $iMenu)
GUICtrlCreateMenuItem("Copy", $iMenu)
GUICtrlCreateMenuItem("Paste", $iMenu)
GUIRegisterMsg($WM_MENURBUTTONUP, "_WM_MENURBUTTONUP")
GUISetState()
Do
Until GuiGetMsg() = -3
Func _WM_MENURBUTTONUP($hWnd, $iMsg, $wparam, $lparam)
Msgbox(0, $wparam, $lparam = GUICtrlGetHandle($iMenu))
EndFunc ;==>_WM_MENURBUTTONUP
页:
[1]