# Function Reference

GUISwitch

Switches the current window used for GUI functions.

GUISwitch ( winhandle [, tabitemID] )

Parameters

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.

Remarks

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("")

Related

GUICreate, GUIDelete

Example

#include <GUIConstants.au3>
$parent1= GUICreate("Parent1")
GUICtrlCreateTab(10,10)
$tabitem = GUICtrlCreateTabItem("tab1")
GUICtrlCreateTabItem("tab2")
GUICtrlCreateTabItem("")
$parent2= GUICreate("Parent2", -1, -1, 100, 100)
GUISwitch($parent2)
GUISetState()
Do
$msg=GUIGetMsg()
until $msg = $GUI_EVENT_CLOSE
GuiSwitch($parent1,$tabitem)
GUICtrlCreateButton("OK",50,50,50)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW,$parent1)
Do
$msg=GUIGetMsg()
until $msg = $GUI_EVENT_CLOSE