GUI in GUI Problem

  • Hallo,

    ich hab hier im Forum dieses Script gefunden:

    Spoiler anzeigen
    [autoit]


    #include<WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
    GUISetOnEvent(-3, "_exit")
    $hChildGUI = GUICreate("Test2", 300, 300, 10, 10, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)
    GUISetOnEvent(-3, "_closeChild")

    [/autoit] [autoit][/autoit] [autoit]

    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChildGUI, "int", 0xEC)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChildGUI, "int", 0xEC, "int", BitOR($nExStyle[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChildGUI, "hwnd", $hGUI)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $hGUI)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _closeChild()
    GUIDelete($hChildGUI)
    EndFunc ;==>_closeChild

    [/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit]

    Das funktioniert zwar super, aber dabei lässt sich das Hauptfenster nicht schließen. Kann man das irgendwie ändern?

  • Lustig fast die leiche frage wollte ich nun auch stellen nur das ich noch fragen wollte wie ich da noch ein paar fenster mit rein bekommen könnte :D

  • Sorry wegen doppel Post aber
    ich bekomms nich hin in einem fenster noch ein paar fenster rein bekommen kann ?(

  • Zitat

    Das funktioniert zwar super, aber dabei lässt sich das Hauptfenster nicht schließen. Kann man das irgendwie ändern?


    Das ist doch gerade der Trick bei Parent Child Windows :P
    Soll heissen ist so gewollt, schliesse das innere Fenster lässt sich auch das Hauptfenster schliessen.

    Achtung Anfänger! :whistling:

    Betrachten des Quellcodes auf eigene Gefahr, bei Übelkeit,Erbrechen,Kopfschmerzen übernehme ich keine Haftung. 8o

  • ok da were einer meiner fragen wohl auch beantwortet aber wie macht man jetz in einem Gui noch ma 2 (oder mehr )
    Fenster rein :thumbup: (ist echt blöd Formuliert :) )

  • Spoiler anzeigen
    [autoit]

    #include<WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
    GUISetOnEvent(-3, "_exit")
    $hChildGUI = GUICreate("Test2", 300, 300, 10, 10, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)
    GUISetOnEvent(-3, "_closeChild")
    $hChildGUI2 = GUICreate("Test3", 200, 200, 10, 10, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)
    GUISetOnEvent(-3, "_closeChild2")
    $hChildGUI3 = GUICreate("Test4", 100, 100, 10, 10, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)
    GUISetOnEvent(-3, "_closeChild3")
    $hChildGUI4 = GUICreate("Test5", 50, 50, 10, 10, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)
    GUISetOnEvent(-3, "_closeChild4")

    [/autoit] [autoit][/autoit] [autoit]

    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChildGUI, "int", 0xEC)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChildGUI, "int", 0xEC, "int", BitOR($nExStyle[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChildGUI, "hwnd", $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    $nExStyle2 = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChildGUI2, "int", 0xEC)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChildGUI2, "int", 0xEC, "int", BitOR($nExStyle[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChildGUI2, "hwnd", $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    $nExStyle3 = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChildGUI3, "int", 0xEC)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChildGUI3, "int", 0xEC, "int", BitOR($nExStyle[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChildGUI3, "hwnd", $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    $nExStyle4 = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChildGUI4, "int", 0xEC)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChildGUI4, "int", 0xEC, "int", BitOR($nExStyle[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hChildGUI4, "hwnd", $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $hChildGUI)
    GUISetState(@SW_SHOW, $hChildGUI2)
    GUISetState(@SW_SHOW, $hChildGUI3)
    GUISetState(@SW_SHOW, $hChildGUI4)
    GUISetState(@SW_SHOW, $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _closeChild()
    GUIDelete($hChildGUI)
    EndFunc ;==>_closeChild

    [/autoit] [autoit][/autoit] [autoit]

    Func _closeChild2()
    GUIDelete($hChildGUI2)
    EndFunc ;==>_closeChild

    [/autoit] [autoit][/autoit] [autoit]

    Func _closeChild3()
    GUIDelete($hChildGUI3)
    EndFunc ;==>_closeChild

    [/autoit] [autoit][/autoit] [autoit]

    Func _closeChild4()
    GUIDelete($hChildGUI4)
    EndFunc ;==>_closeChild

    [/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit]

    MfG xXTobi93Xx