#Include <GUIConstants.au3>
#Include <WindowsConstants.au3>
$main_GUI = GUICreate("_GUICtrlCreateTabEx Demo", 400, 250, -1, -1)
$aTab1 = _GUICtrlCreateTabEx($main_GUI, 10, 10, 180, 200)
GUICtrlCreateTabItem("Tab1 Item1")
GUICtrlCreateLabel("Tab1 Label", 20, 60, 70, 20)
GUICtrlCreateTabItem("Tab1 Item2")
GUICtrlCreateButton("Tab1 Button", 20, 60, 70, 20)
GUICtrlCreateTabItem("")
$aTab2 = _GUICtrlCreateTabEx($main_GUI, 200, 10, 190, 200)
GUICtrlCreateTabItem("Tab2 Item1")
GUICtrlCreateLabel("Tab2 Label", 20, 60, 70, 20)
GUICtrlCreateTabItem("Tab2 Item2")
GUICtrlCreateButton("Tab2 Button", 20, 60, 70, 20)
GUICtrlCreateTabItem("")
GUISwitch($main_GUI)
$OK_Button = GUICtrlCreateButton("OK", 10, 220, 70, 20)
$Cancel_Button = GUICtrlCreateButton("Cancel", 90, 220, 70, 20)
_GUICtrlTabEx_Show($aTab1)
_GUICtrlTabEx_Show($aTab2)
GUISetState(@SW_SHOW, $main_GUI)
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE, $Cancel_Button
ExitLoop
Case $aTab1[1]
ConsoleWrite("Tab 1, Item: " & GUICtrlRead($nMsg[0]) & @LF)
Case $aTab2[1]
ConsoleWrite("Tab 2, Item: " & GUICtrlRead($nMsg[0]) & @LF)
EndSwitch
WEnd
Func _GUICtrlCreateTabEx($hWnd, $iX, $iY, $iWidth = 150, $iHeight = 150)
Local $hTab, $nTab, $aRet
$hTab = GUICreate("", $iWidth, $iHeight, $iX, $iY, BitOR($WS_CHILD, $WS_TABSTOP), -1, $hWnd)
$nTab = GUICtrlCreateTab(0, 0, $iWidth, $iHeight)
Dim $aRet[2] = [$hTab, $nTab]
Return $aRet
EndFunc
Func _GUICtrlTabEx_Show($ahTab)
If Not IsArray($ahTab) Or Not IsHWnd($ahTab[0]) Then
Return SetError(1, 0, 0)
EndIf
GUISetState(@SW_SHOW, $ahTab[0])
EndFunc