找回密码
 加入
搜索
查看: 2092|回复: 2

[AU3基础] 窗体实现可取消的默认按钮 【已解决】

[复制链接]
发表于 2010-8-29 12:25:07 | 显示全部楼层 |阅读模式
本帖最后由 haodd 于 2010-8-29 13:44 编辑
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("请确认您的信息", 234, 98, 192, 114)
$Button1 = GUICtrlCreateButton("确定", 24, 48, 75, 25,-1)
;这里最后加个 -1 或者 default 已经选择了执行了
$Button2 = GUICtrlCreateButton("取消", 120, 48, 75, 25)
$Label1 = GUICtrlCreateLabel("默认10秒后运行记事本,手动点击确定立即执行记事本,点击关闭或取消关闭本程序不运行记事本", 8, 8, 214, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $nMsg = $Button1
                        Sleep(10000)
                        Run('Notepad.exe')
                        Exit
                Case $nMsg = $Button2
                        Exit
        EndSwitch
WEnd
$Button1 = GUICtrlCreateButton("确定", 24, 48, 75, 25,-1)
;这里最后加个 -1 或者 default 已经选择了执行了

我想达到这种目的
运行程序后
默认10秒后运行记事本,手动点击确定立即执行记事本不用等待10秒,点击关闭或取消关闭本程序不运行记事本

需要窗体实现 不要msgbox
发表于 2010-8-29 13:13:25 | 显示全部楼层
#include <WindowsConstants.au3>
$Form1 = GUICreate("请确认您的信息", 234, 98, 192, 114)
$Button1 = GUICtrlCreateButton("确定", 24, 48, 75, 25, -1)
;这里最后加个 -1 或者 default 已经选择了执行了
$Button2 = GUICtrlCreateButton("取消", 120, 48, 75, 25)
$Label1 = GUICtrlCreateLabel("默认10秒后运行记事本,手动点击确定立即执行记事本,点击关闭或取消关闭本程序不运行记事本", 8, 8, 214, 33)
GUISetState()
AdlibRegister('Notepad', 10000)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case - 3, $Button2
                        Exit
                Case $Button1
                        Notepad()
        EndSwitch
WEnd

Func Notepad()
        AdlibUnRegister('Notepad')
        Run('Notepad.exe')
EndFunc   ;==>Notepad

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2010-8-29 13:44:27 | 显示全部楼层
呵呵 有是水木  谢谢哈
Func Notepad()
        AdlibUnRegister('Notepad')
        Run('Notepad.exe')
        Exit
EndFunc  
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-3 10:32 , Processed in 0.096407 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表