Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[problem] Zamknięcie drugiego GUI


Maximus6545

Rekomendowane odpowiedzi

Opublikowano

Siema, mam problem z zamknięciem drugiego GUI, dałem @SW_HIDE i ukryło to GUI jednak nie mogłem nic zrobić w tym pierwszym GUI .. i musiałem zamknąć program przez menadżera zadań. Powie ktoś jak zamknąć drugie GUI innym sposobem ??

Opublikowano
Func _Ustawienia()
     Local $font
$hGUI2 = GUICreate("Ustawienia", 450, 350, -1, -1)
     $Button10 = GUICtrlCreatePic(@AppDataDir&'\Conquest.jpg', 250, 80, 170, 40)
GUISetState()
    
     While 1
        $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
         Exit
         Case $Button10
GUIDelete()
    EndSwitch
WEnd
     EndFunc

 

Tak nie działa dalej pierwsze GUI się zawiesza.

Opublikowano


#include <GUIConstantsEx.au3>

 

Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

 

gui1()

 

Func gui1()

$hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)

$hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30)

$hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)

GUISetState()

 

While 1

$aMsg = GUIGetMsg(1) ; Use advanced parameter to get array

Switch $aMsg[1] ; check which GUI sent the message

Case $hGUI1

Switch $aMsg[0] ; Now check for the messages for $hGUI1

Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<<

ExitLoop

Case $hButton1

MsgBox("", "MsgBox 1", "Test from Gui 1")

Case $hButton2

GUICtrlSetState($hButton2, $GUI_DISABLE)

gui2()

EndSwitch

Case $hGUI2

Switch $aMsg[0] ; Now check for the messages for $hGUI2

Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<

GUIDelete($hGUI2)

GUICtrlSetState($hButton2, $GUI_ENABLE)

Case $hButton3

MsgBox("", "MsgBox", "Test from Gui 2")

EndSwitch

EndSwitch

WEnd

EndFunc ;==>gui1

 

Func gui2()

$hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350)

$hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)

GUISetState()

EndFunc ;==>gui2

4758463064.png

 

Opublikowano

 

 #include <GUIConstantsEx.au3>

 Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

 gui1()

 Func gui1()
     $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)
     $hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30)
     $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)
     GUISetState()

     While 1
         $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
         Switch $aMsg[1] ; check which GUI sent the message
             Case $hGUI1
                 Switch $aMsg[0] ; Now check for the messages for $hGUI1
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<<
                         ExitLoop
                     Case $hButton1
                         MsgBox("", "MsgBox 1", "Test from Gui 1")
                     Case $hButton2
                         GUICtrlSetState($hButton2, $GUI_DISABLE)
                         gui2()
                 EndSwitch
             Case $hGUI2
                 Switch $aMsg[0] ; Now check for the messages for $hGUI2
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<
                         GUIDelete($hGUI2)
                         GUICtrlSetState($hButton2, $GUI_ENABLE)
                     Case $hButton3
                         MsgBox("", "MsgBox", "Test from Gui 2")
                 EndSwitch
         EndSwitch
     WEnd
 EndFunc   ;==>gui1

 Func gui2()
     $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350)
     $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)
     GUISetState()
 EndFunc   ;==>gui2

 

To po prostu kod z wiki autoita :P http://www.autoitscript.com/wiki/Managing_Multiple_GUI

Tam masz skrypty więc tam działają ;)

Od dnia 1.11.2013r. 14:17 zobaczono moje posty licznik-56-90712-stat.png razy ;)


 


 

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...