找回密码
 加入
搜索
查看: 2059|回复: 3

[GUI管理] GUICreate最后一个“父窗口”的参数貌似无效。(已解决)

[复制链接]
发表于 2011-9-25 22:50:28 | 显示全部楼层 |阅读模式
本帖最后由 nmgwddj 于 2011-9-25 23:49 编辑

用GUICreate创建窗口后,指定父窗口为form1
$Form2 = GUICreate("Form2", 242, 146, 556, 300, -1, -1, $Form1)
代码是这样写的,代码开始显示form1窗口,中间需要用到的时候,用GUISetState显示form2窗口。

不知道是我用法不对还是?

我想达到的效果就是msgbox后面父窗口的参数添加上以后,不能操作父窗口,必须关掉提示才能操作。
发表于 2011-9-25 23:11:23 | 显示全部楼层
本帖最后由 xiehuahere 于 2011-9-25 23:22 编辑

已经有人问过了:
http://www.autoitx.com/forum.php ... =%B8%B8%B4%B0%BF%DA

你也可以试试这个:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$Button1 = GUICtrlCreateButton("Launch Form2", 224, 168, 169, 65)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        GUISetState(@SW_DISABLE, $Form1)
                        LaunchForm2()
                        GUISetState(@SW_ENABLE, $Form1)
                        GUISetState(@SW_RESTORE, $Form1)
        EndSwitch
WEnd

Func LaunchForm2()
        $Form2 = GUICreate("Form2", 242, 146, 556, 300, -1, -1, $Form1)
        GUISetState(@SW_SHOW, $Form2)
        While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                                GUIDelete($Form2)
                                ExitLoop
                EndSwitch
        WEnd
EndFunc
其实,这样做的话,加不加父窗口的句柄都无所谓。
 楼主| 发表于 2011-9-25 23:49:22 | 显示全部楼层
学习学习,之前还真没有看到过。发现如果form2窗口如果不加while循环,也不会有这样的效果。
发表于 2012-11-20 21:45:05 | 显示全部楼层
这个也记号,以备后查
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-29 19:25 , Processed in 0.083371 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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