找回密码
 加入
搜索
查看: 1600|回复: 6

请问高手如何设置重新运行窗口

[复制链接]
发表于 2009-3-4 19:20:04 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("主窗口", 399, 257, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 24, 144, 121, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Button1
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("子窗口", 200, 100, 150, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

        EndSwitch
WEnd


[ 本帖最后由 17911 于 2009-3-5 11:51 编辑 ]
发表于 2009-3-4 20:29:29 | 显示全部楼层
这个重新运行是什么意思

GUIDelete

GUICreate  
行不行?
发表于 2009-3-4 20:30:36 | 显示全部楼层

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

$Form1 = GUICreate("主窗口", 399, 257, 192, 124)
$Button1 = GUICtrlCreateButton("显示子窗口", 24, 144, 121, 33, 0)
$Form2 = GUICreate("子窗口", 200, 100, 150, 100)
$Button2 = GUICtrlCreateButton("显示主窗口", 24, 10, 121, 33, 0)
GUISetState(@SW_SHOW, $Form1)

While 1
        $nMsg = GUIGetMsg(1)
        Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                        If $nMsg[1] == $Form1 Then
                                Exit
                        ElseIf $nMsg[1] == $Form2 Then
                                GUISetState(@SW_SHOW, $Form1)
                                GUISetState(@SW_HIDE, $Form2)
                        EndIf
        Case $Button1
                        GUISetState(@SW_SHOW, $Form2)
                        GUISetState(@SW_HIDE, $Form1)
                Case $Button2
                        GUISetState(@SW_SHOW, $Form1)
                        GUISetState(@SW_HIDE, $Form2)
        EndSwitch
WEnd
 楼主| 发表于 2009-3-4 20:36:18 | 显示全部楼层
原帖由 sxd 于 2009-3-4 20:29 发表
这个重新运行是什么意思

GUIDelete

GUICreate  
行不行?



你好,我的意思是点子窗口同时关闭主窗口与子窗口后,然后可以自动再次运行主窗口,就想有的软件退出重新启动一样,不是设置隐藏,同时感谢3楼朋友的友情解答

[ 本帖最后由 17911 于 2009-3-4 20:55 编辑 ]
发表于 2009-3-4 21:48:20 | 显示全部楼层
初步想到 用多个exe来实现吧
 楼主| 发表于 2009-3-4 22:01:45 | 显示全部楼层
原帖由 sxd 于 2009-3-4 21:48 发表
初步想到 用多个exe来实现吧

这个方法见到了,可行,不知道有没有其他方法
发表于 2009-3-4 22:23:47 | 显示全部楼层
把主窗体放循环里 退出循环就重新运行了主窗口 引用了3楼的代码。。。
[AU3]#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
While 1
        $reset = False
        $Form1 = GUICreate("主窗口", 399, 257, 192, 124)
        $Button1 = GUICtrlCreateButton("显示子窗口", 24, 144, 121, 33, 0)
        $Form2 = GUICreate("子窗口", 200, 100, 150, 100)
        $Button2 = GUICtrlCreateButton("显示主窗口", 24, 10, 121, 33, 0)
        GUISetState(@SW_SHOW, $Form1)

        While 1
                $nMsg = GUIGetMsg(1)
                Switch $nMsg[0]
                        Case $GUI_EVENT_CLOSE
                                If $nMsg[1] == $Form1 Then
                                        Exit
                                ElseIf $nMsg[1] == $Form2 Then
                                        GUISetState(@SW_SHOW, $Form1)
                                        GUISetState(@SW_HIDE, $Form2)
                                EndIf
                        Case $Button1
                                GUISetState(@SW_SHOW, $Form2)
                                GUISetState(@SW_HIDE, $Form1)
                        Case $Button2
                                GUISetState(@SW_SHOW, $Form1)
                                GUISetState(@SW_HIDE, $Form2)
                                $reset = True
                EndSwitch
                If $reset = True Then ExitLoop
        WEnd
WEnd[/au3]

[ 本帖最后由 大绯狼 于 2009-3-4 22:42 编辑 ]

评分

参与人数 1金钱 +5 收起 理由
17911 + 5 问题解决

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 00:34 , Processed in 0.078123 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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