PROC_dlgctrl(dlg%, "", id%, x%, y%, cx%, cy%, 0, "SysTabControl32")
INSTALL @lib$+"WINLIB2"
REM!WC
ICC_TAB_CLASSES = 8
TCIF_TEXT = 1
TCM_INSERTITEMA = 4871
WS_CHILD = &40000000
WS_VISIBLE = &10000000
DIM icex{dwSize%, dwICC%}
icex.dwSize% = DIM(icex{})
icex.dwICC% = ICC_TAB_CLASSES
SYS "InitCommonControlsEx", icex{}
REM Trapping errors is desirable; otherwise an error
REM message may be hidden behind the tab control:
ON ERROR SYS "MessageBox", @hwnd%, REPORT$, 0, 48 : QUIT
REM You create an 'empty' tab control as follows:
tcid% = 101
dlg% = FN_newdialog("Tab Control in Dialogue Box", 0, 0, 300, 250, 8, 1000)
PROC_dlgctrl(dlg%, "", tcid%, 10, 10, 280, 230, WS_VISIBLE OR WS_CHILD, "SysTabControl32")
PROC_showdialog(dlg%)
SYS "GetDlgItem", !dlg%, tcid% TO hTC%
IF hTC% = 0 ERROR 100, "Couldn't create tab control"
REM At this stage the control doesn't have any tabs;
REM to add them use code similar to the following:
PROCadd_tab(hTC%, "First", 1)
PROCadd_tab(hTC%, "Second", 2)
PROCadd_tab(hTC%, "Third", 3)
REPEAT WAIT 1 : UNTIL FALSE
END
DEF PROCadd_tab(htc%, text$, id%)
LOCAL cti{}, res%
DIM cti{mask%, dwState%, dwStateMask%, pszText%, cchTextMax%, iImage%, lparam%}
text$ += CHR$0
cti.mask% = TCIF_TEXT
cti.pszText% = !^text$
SYS "SendMessage", htc%, TCM_INSERTITEMA, id%, cti{} TO res%
IF res% = -1 ERROR 100, "Couldn't send Tab Control info"
ENDPROC