|
Компьютерный форум OSzone.net » Программирование, базы данных и автоматизация действий » AutoIt » [решено] Как сделать чтобы дочернее окно при выходе не закрывало основное окно |
|
[решено] Как сделать чтобы дочернее окно при выходе не закрывало основное окно
|
Пользователь Сообщения: 62 |
Профиль | Отправить PM | Цитировать
В Autoit есть пример там дочернее окно при закрытии не закрывает основное окно, но там без кнопки а кнопку на тот пример поставить мне не удалось.
Вот пример с кнопкой, при нажатии создаётся дочернее окно а при выходе оно закрывает основное. Как сделать так чтобы оно при закрытии не закрывало основное окно? #include <GUIConstants.au3> Global $2 $1 = GUICreate("1") $But = GUICtrlCreateButton("1", 50, 50, 80, 40 , $BS_FLAT) GUISetState () While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $But Function() Case $iMsg = $GUI_EVENT_CLOSE Exit EndSelect Wend Func Function() $2 = GUICreate("2", 333, 333, -1, -1, -1, -1, $1) GUISetState() EndFunc |
|
Отправлено: 00:00, 19-07-2010 |
Ветеран Сообщения: 553
|
Профиль | Отправить PM | Цитировать ;==================================================== ;============= Example of a child window ============ ;==================================================== ; AutoIt version: 3.0.103 ; Language: English ; Author: "SlimShady" ; ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- ;Include constants #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() ;Initialize variables Local $GUIWidth = 250, $GUIHeight = 250 Local $ParentWin, $ParentWin_Pos, $ChildWin, $msg ;Create main/parent window $ParentWin = GUICreate("Parent GUI", $GUIWidth, $GUIHeight) ;Save the position of the parent window $ParentWin_Pos = WinGetPos($ParentWin, "") ;Show the parent window/Make the parent window visible GUISetState(@SW_SHOW) ;Create child window and add the parameter to make it the child of the parent window $ChildWin = GUICreate("Child GUI", $GUIWidth, $GUIHeight, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $ParentWin) ;Show the child window/Make the child window visible GUISetState(@SW_SHOW) ;Switch to the parent window GUISwitch($ParentWin) ;Loop until: ;- user presses Esc when focused to the parent window ;- user presses Alt+F4 when focused to the parent window ;- user clicks the close button of the parent window While 1 ;After every loop check if the user clicked something in the GUI windows $msg = GUIGetMsg(1) Select ;Check if user clicked on a close button of any of the 2 windows Case $msg[0] = $GUI_EVENT_CLOSE ;Check if user clicked on the close button of the child window If $msg[1] = $ChildWin Then MsgBox(64, "Test", "Child GUI will now close.") ;Switch to the child window GUISwitch($ChildWin) ;Destroy the child GUI including the controls GUIDelete() ;Check if user clicked on the close button of the parent window ElseIf $msg[1] = $ParentWin Then MsgBox(64, "Test", "Parent GUI will now close.") ;Switch to the parent window GUISwitch($ParentWin) ;Destroy the parent GUI including the controls GUIDelete() ;Exit the script Exit EndIf EndSelect WEnd EndFunc ;==>_Main |
Отправлено: 00:21, 19-07-2010 | #2 |
Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети. Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля. |
Пользователь Сообщения: 62
|
Профиль | Отправить PM | Цитировать Про этот пример я и писал
Но этот пример без кнопки А кнопку на этот пример почему то поставить проблематично |
Отправлено: 00:28, 19-07-2010 | #3 |
Must AutoIt Сообщения: 3054
|
Профиль | Сайт | Отправить PM | Цитировать assch, код нужно заключать в теги [cоde].
Цитата assch:
#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Global $2 $1 = GUICreate("1") $But = GUICtrlCreateButton("1", 50, 50, 80, 40, $BS_FLAT) GUISetState() While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[0] Case $But Function() Case $GUI_EVENT_CLOSE If $nMsg[1] = $2 Then GUISetState(@SW_HIDE, $2) Else Exit EndIf EndSwitch WEnd Func Function() If Not IsHWnd($2) Then $2 = GUICreate("2", 333, 333, -1, -1, -1, -1, $1) EndIf GUISetState(@SW_SHOW, $2) WinActivate($2) EndFunc |
|
------- Отправлено: 01:11, 19-07-2010 | #4 |
Ветеран Сообщения: 553
|
Профиль | Отправить PM | Цитировать Цитата assch:
|
||
Отправлено: 01:18, 19-07-2010 | #5 |
Пользователь Сообщения: 62
|
Профиль | Отправить PM | Цитировать Спасибо Creat0R
|
Отправлено: 02:11, 19-07-2010 | #6 |
Участник сейчас на форуме | Участник вне форума | Автор темы | Сообщение прикреплено |
| |||||
Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
CMD/BAT - [решено] как сделать чтобы окно не закрывалось? | Ingolder | Скриптовые языки администрирования Windows | 12 | 20-01-2015 19:10 | |
PowerShell - [решено] как сделать чтобы окно не закрывалось? | Ingolder | Скриптовые языки администрирования Windows | 4 | 09-12-2009 13:10 | |
Создать дочернее окно IE | Shampur | AutoIt | 9 | 20-08-2009 18:55 | |
Можно сделать без скриптов чтобы окно IE открывалось без меню и пр.? | Gamover jr | Вебмастеру | 1 | 14-02-2008 18:28 | |
[решено] Как сделать, чтобы при выходе в инет включались автоматически определенные программы? | yanvlad | Microsoft Windows 2000/XP | 15 | 25-02-2007 11:10 |
|