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

如何在关闭子窗口时不关闭父窗口?

[复制链接]
发表于 2008-6-13 13:18:53 | 显示全部楼层 |阅读模式
$gui1 = GUICreate()
$button = GUICtrlCreateButton()
GUISetState()
While 1
  $msg = GUIGetMsg()

  Select
    Case $button
      $gui2 = GUICreate(,,,$gui1)
      $edit = GUICtrlCreateEdit()

    Case $msg = $GUI_EVENT_CLOSE
     
      ExitLoop
  EndSelect
WEnd

如何在关闭$gui2时不使$gui1也被同时关掉?
发表于 2008-6-13 14:39:03 | 显示全部楼层
$gui1 = GUICreate()
$button = GUICtrlCreateButton()
GUISetState()
While 1
  $msg = GUIGetMsg()

  Select
    Case $button
      $gui2 = GUICreate(,,,$gui1)
      $edit = GUICtrlCreateEdit()

    Case $msg = $GUI_EVENT_CLOSE
     
      GUIDelete()    ; 销毁前面的窗口
  EndSelect
WEnd
发表于 2008-6-13 20:01:26 | 显示全部楼层
可以用隐藏窗口的办法。不错的选择。
发表于 2008-6-13 20:29:52 | 显示全部楼层
GUIDelete(字窗口)
 楼主| 发表于 2008-6-14 12:21:12 | 显示全部楼层
gui中好像没有检测gui是否存在的函数
只有用winexists来检测子窗口的存在
关闭父窗口时还有些删文件的操作
所以只有用选择语句来判断
If  WinExists() Then
   GUIDelete($gui2)
ElseIf Not WinExists() Then
   DirRemove(@AppDataDir & "\skin", 1)
   DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui1, "int", 600, "long", 0x00010010)
   GUISetState()
   Exit
Endif
但运行起来有个问题
就是打开子窗口后,
如果点父窗口的关闭键则需点两次:
先关子窗口后再点一次才关父窗口
如何使子窗口打开后如不关闭则无法对父窗口进行操作?
发表于 2008-6-25 01:09:54 | 显示全部楼层
在父窗口直接点关闭的时候用EXIT函数没有试过要点两次的。

如果想打开子窗口父窗口操作不了的话,可以锁定父窗口。

即:GUISetState(@SW_DISABLE, $hGUI)
发表于 2009-9-2 19:45:14 | 显示全部楼层
精辟,这样很好
发表于 2009-9-2 21:47:37 | 显示全部楼层
切换窗口用guigetmsg(1),简单有效,怎么有这么多的人问这个问题
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 21:31 , Processed in 0.071238 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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