Jump to content

Recommended Posts

Posted

example

 

$Form1 = GUICreate("form1", 402, 178, 244, 153)

GUISetState(@SW_SHOW)

$MenuItem3 = GUICtrlCreateMenuItem("About ;", $MenuItem1)

$Form2 = GUICreate("About ; ", 297, 144, 328, 312)

GUISetState(@SW_SHOW)

 

Click $MenuItem3 show form2

and

{X} Exit form2 one

 

  • Moderators
Posted

InJuriesX,

Read the help file for GUICtrlCreateMenuItem to see how to correctly action  the menu item events.

Reading the Managing Multiple GUIs tutorial in the Wiki will explain how to create and close the child GUI.

Come back if you still have problems.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

InJuriesX,

Did you read the tutorial to which I linked? Please post the code you used - see here how to do it.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;this my tools

;Speed Win by registry
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Speed Win InJuriesX", 402, 178, 244, 153)
$Pic1 = GUICtrlCreatePic("D:\صصور\صور\Wallpapers-room_com___Minimal_Wood_3_by_dimage_1920x1200.jpg", 0, -8, 401, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Speed Win", 120, 64, 169, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
$MenuItem1 = GUICtrlCreateMenu("File ; ")
$MenuItem4 = GUICtrlCreateMenuItem("Rest ; ", $MenuItem1)
GUICtrlSetState(-1, $GUI_CHECKED)
$MenuItem3 = GUICtrlCreateMenuItem("About ;", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenuItem("Exit ; ", $MenuItem1)
#EndRegion ### END Koda GUI section ###
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $MenuItem4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;here code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Case $MenuItem3
$Form2 = GUICreate("About ; ", 297, 144, 328, 312)
$Edit1 = GUICtrlCreateEdit("", 16, 16, 265, 97)
GUICtrlSetData(-1, StringFormat("My Account ; \r\nyoutube ; injuries yemen\r\noovoo ; al_ko_oon\r\nEmail Gmail ; weaklyinjuries@gmail.com"))
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Case $MenuItem2
Exit
Case $Button1
;here code
EndSwitch
WEnd

 

Posted

We understand, as pointed out already, you should check the posted link.

If you're too lazy, check this code:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Create a GUI.
    Local $hGUI1 = GUICreate("Example GUI1")
    ; Create a button.
    Local $idButton1 = GUICtrlCreateButton("Button1", 10, 10, 80, 22)
    ; Display the GUI
    GUISetState(@SW_SHOW, $hGUI1)

    ; Create a GUI.
    Local $hGUI2 = GUICreate("Example GUI2", 300, 300)
    ; Create a button.
    Local $idButton2 = GUICtrlCreateButton("Button2", 10, 10, 80, 22)
    ; Display the GUI
    GUISetState(@SW_SHOW, $hGUI2)

    ; Initialize a Local variable.
    Local $aMsg = 0

    While 1
        ; Assign to $aMsg the advanced GUI messages.
        $aMsg = GUIGetMsg($GUI_EVENT_ARRAY)

        ; Switch from GUIs
        Switch $aMsg[1]
            Case $hGUI1
                ; The event comes from the GUI1

                ; Switch from event ID
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $idButton1
                        MsgBox($MB_SYSTEMMODAL, "", "Button1 clicked.")
                EndSwitch
            Case $hGUI2
                ; The event comes from the GUI2

                ; Switch from event ID
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($hGUI2)
                    Case $idButton2
                        MsgBox($MB_SYSTEMMODAL, "", "Button2 clicked.")
                EndSwitch
        EndSwitch
    WEnd

    ; Delete the previous GUIs and all controls.
    GUIDelete($hGUI1)
EndFunc   ;==>Example

There's also GUISetOnEvent but you'd have to change some code.

Basic idea is you need to let the script know what window you want to close and use

GUIDelete($Form2)

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...