找回密码
 加入
搜索
查看: 1690|回复: 7

GUI问题

[复制链接]
发表于 2009-7-6 11:22:52 | 显示全部楼层 |阅读模式
$Button1                = GuiCtrlCreateButton("运行", 260, 90, 50, 20)
$Button2                = GuiCtrlCreateButton("停止", 260, 90, 50, 20)
怎样做到点击“运行”就显示“停止”
而且运行时要执行一个自动操作。
停止时就停止这个操作。
弄了好久都没有实现。
哪位大侠帮帮忙。。
发表于 2009-7-6 11:41:12 | 显示全部楼层
本帖最后由 kn007 于 2009-7-6 14:39 编辑

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("测试", 133, 65, 192, 124)
GUISetState(@SW_SHOW)
$Button1 = GUICtrlCreateButton("运行", 15, 36, 58, 25, 0)
While 1

        $nMsg = GUIGetMsg()
        Switch $nMsg
          Case $GUI_EVENT_CLOSE
                Exit
                Case $Button1
                        abc()
        EndSwitch

WEnd

Func abc()
        If GUICtrlRead($Button1) = "运行" Then
                GUICtrlSetData($Button1, "停止")
        Else
                GUICtrlSetData($Button1, "运行")
        EndIf
EndFunc
 楼主| 发表于 2009-7-6 14:03:37 | 显示全部楼层
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $Button1
                        abc()
        EndSwitch

WEnd

但是这个死会循环的
如果我点击了一下“运行”
显示“停止”时就会立即的自动跳到“运行”
发表于 2009-7-6 14:17:42 | 显示全部楼层
关键是理解别人代码的思路。
发表于 2009-7-6 14:39:47 | 显示全部楼层
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $Button1
                        abc()
        EndSwitch

WEnd

但是这个死会循环的
如果我点击了一下“运行”
显示 ...
36158130 发表于 2009-7-6 14:03


修改好了,你自己不会改啊。。。给你个思路而已
 楼主| 发表于 2009-7-6 17:25:02 | 显示全部楼层

还是没有搞定
不过用另一种解决方案了
谢谢啦
发表于 2009-7-6 19:05:24 | 显示全部楼层
楼主的意思其实关键是暂停脚本的运行
这个论坛很多相关的资料了
http://www.autoitx.com/search.ph ... mp;searchsubmit=yes
发表于 2009-7-6 19:13:23 | 显示全部楼层
你不觉得按你这样理解不对题?

大概是我想错了,而且我这种也可以达到你所说的要求。。。。

算了,不想太多了,你那键盘数组能帮我不?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 01:28 , Processed in 0.077835 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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