Jump to content
Sign in to follow this  

Controls from one GUI on the second GUI

Recommended Posts

I got this:

#cs ----------------------------------------------------------------------------

 AutoIt Version:
 Author:         Eise van der Spoel

 Script Function:
    Foto's bekijken voor de kerk

#ce ----------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <File.au3>
#Include <Array.au3>
Dim $fotoArray
Global $Filter = "*.jpg"
Global $ShowGUI,$MainGUI
Global $Title = "Foto Show v1.0"

Func _MainGUI()
    Local $_MainGUIW = 415
    Local $_MainGUIH = 55
    $MainGUI = GuiCreate($Title,$_MainGUIW,$_MainGUIH)
    $map = GuiCtrlCreateButton("Map",1,2,40)
    $start = GuiCtrlCreateButton("Start",45,2,40)
    $stop = GuiCtrlCreateButtoN("Stop",90,2,40)
    $vorige = GuiCtrlCreateButton("<",145,2,20)
    $volgende = GuiCtrlCreateButton(">",170,2,20)
    $pauze = GuiCtrlCreateButton("||",195,2,20)
    $sluiten = GuiCtrlCreateButton("Sluiten",$_MainGUIW - 49,2,40)
    While 1
        $msg = GuiGetMsg()
        Switch $msg
        Case $map
            $photo_folder = FileSelectFolder("", "", 1)
            If @Error=1 Then
                MsgBox (0,"","No Files\Folders Found.")
        Case $start
            if WinExists("fotoshow") Then
        Case $stop
        Case $GUI_EVENT_CLOSE,$sluiten
            Exit 0

Func _Openshow()
    Local $_ShowGUIW = @DesktopWidth
    Local $_ShowGUIH = @DesktopHeight
    Local $_logoW = 535
    Local $_logoH = 535
    $ShowGUI = GuiCreate("fotoshow",$_ShowGUIW,$_ShowGUIH,0,0,$WS_POPUP)
    GUICtrlCreatePic("logogkv.jpg",($_ShowGUIW - $_logoW)/2,($_ShowGUIH - $_logoH)/2,$_logoW,$_logoH)

Func _hidebar()
    GuiSetState($ShowGUI,@SW_HIDE )

How can i control the second GUI with the buttons from the first GUI?

Share this post

Link to post
Share on other sites


Switches the current window used for GUI functions.

GUISwitch ( winhandle [, tabitemID] )


winhandle: The handle of the window to switch to.

tabitemID: ControlID of the tabitem control to be selected.

Return Value

Success: Returns the handle of the previously current.

Failure: Returns a NULL handle.


Many of the GUI specific functions work on the "current" window - this is usually the last window created with GUICreate. This function allows you to make another window "current". That's does not mean that the referenced window will become active. You have to use WinActivate.

Using the tabitemID allow to create new control in the specified tabitem control. Don't forget to close tabitem definition GuiCtrlCreateTabItem("")

Share this post

Link to post
Share on other sites

Don't feel too bad; I've been using AutoIT for almost a year now and there are still functions that I don't exactly recall how to use. The Autoit3.CHM file is almost always open on my 2nd monitor when I'm building a brand new AutoIT script.

Case in point: I knew exactly what you needed, but I couldn't remember the command :) Typed in GUI into search and recognized the command in the list of topic results...

Share this post

Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...