(已解决)如何在一个按钮上点右键打开一个文件或文件夹
本帖最后由 痒痒 于 2011-6-29 21:33 编辑如何在一个按钮上点右键打开一个文件或文件夹 朋友们给解答下啊 点右键只能捕捉窗口吧! 按钮不知道 用$GUI_EVENT_SECONDARYDOWN事件来判断触发鼠标右键的情况,然后可以用GUIGetCursorInfo来获取到鼠标悬停位置的控件 ID,如果是目标按钮,则执行啥啥呗 试着练习了以下
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 194, 101, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("Button1", 32, 32, 129, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
GetPos()
Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func GetPos()
Local $a = GUIGetCursorInfo($Form1)
If $a = $Button1 And $a = 1 Then
run("explorer.exe /e,C:\")
EndIf
EndFunc ;==>GetPos
雷锋精神传天下!谢谢分享!
页:
[1]