# Function Reference

# _GUICtrlTab_InsertItem

Inserts a new tab

#include <GuiTab.au3>
_GUICtrlTab_InsertItem ( $hWnd, $iIndex, $sText [, $iImage = -1 [, $iParam = 0]] )

## Parameters

$hWnd | Control ID/Handle to the control
$iIndex | Index of the new tab
$sText | Tab text
$iImage | [optional] 0-based tab image index
$iParam | [optional] Application defined data

## Return Value

Success: | the 0-based index of the new tab.
Failure: | -1.

## Example

### Example 1

    #include "Extras\HelpFileInternals.au3"

    #include <GUIConstantsEx.au3>
    #include <GuiTab.au3>

    Example()

    Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Tab Control Insert Item (v" & @AutoItVersion & ")", 450, 300, 100, 100)
        Local $idTab = GUICtrlCreateTab(2, 2, 446, 266)
        _MemoMsgBoxStatus() ; Status creation

        GUISetState(@SW_SHOW)

        ; Add tabs
        _GUICtrlTab_InsertItem($idTab, 0, "Tab 0")
        _GUICtrlTab_InsertItem($idTab, 1, "Tab 1")
        _GUICtrlTab_InsertItem($idTab, 2, "Tab 2")

        _MemoMsgBox($MB_SYSTEMMODAL, "Information", "Insert 3 Items")

        _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

    EndFunc   ;==>Example

### Example (OutProcess) : Tab Insert Item to an External process

    #include "Extras\HelpFileInternals.au3"

    #include <GuiTab.au3>

    Example()

    Func Example()
        Local $sFromTo
        Local $hWin = _MemoRunAU3OutProcess($sFromTo, False) ; OK also if running in deifferent mode
        Local $hTabCtrl = _MemoCreateOutProcess($hWin, "SysTabControl32", 1, $sFromTo)

        _GUICtrlTab_InsertItem($hTabCtrl, 2, "<<<Tab 4")
        _MemoMsgBox($MB_SYSTEMMODAL, "Info" & $sFromTo, "Insert item #2")

        _MemoMsgBoxStatus("", -1, $hWin) ; no more action, wait GUI for closing

    EndFunc   ;==>Example