I have a main modal dialog box which has a TAB Control with three tab defined. At run time, based on user selection from the main dialog box, I want to disable certain TABs. Is there a way to disable a TAB control at run time?
According to MSDN, "You cannot disable an individual tab in a tab control. However, you can disable a tab control in a property sheet by disabling the corresponding page."
By the way, I recommend that you set a "Display Name" for use in the forum, as email addresses are no longer allowed as display names. Click on your name in the upper right of the page and select Dashboard, then edit your profile.
I think you can disable a tab within a multitab control by making it invisible, not the same as leaving it visible but greyed-out. Take a look,
! Adds a tab page to a tab control. ! ! hwnd: window handle of dialog box containing tab control ! controlId: control ID of tab control ! position: 1-based position in tab control to insert tab ! nameId: string resource ID for tab name ! resourceId: dialog resource ID for tab page contents ! dialogProc: dialog callback proc for tab page ! ! Return value: window handle to tab page ! INTEGER FUNCTION TabControlAddPage(hwnd, controlId, position, nameId, & pageId, dialogProc) RESULT(hwndTabPage) IMPLICIT NONE INTEGER(HANDLE), INTENT(IN) :: hwnd INTEGER, INTENT(IN) :: controlId INTEGER, INTENT(IN) :: position INTEGER, INTENT(IN) :: nameId INTEGER, INTENT(IN) :: pageId INTEGER, INTENT(IN) :: dialogProc INTEGER :: rval INTEGER(HANDLE) :: hwndTabControl TYPE(T_RECT) :: tabRect TYPE(T_POINT) :: point hwndTabPage = -1 hwndTabControl = DialogGetControlWindow (hwnd, controlId) hwndTabPage = DialogCreate (pageId, dialogProc, hwnd) IF (hwndTabPage /= -1) THEN CALL TabControlAddTab (hwnd, controlId, STGet(nameId, 100), & position, hwndTabPage) ! store the resource ID for the tab page in the window extra ! memory location, for future identification rval = SetWindowLong(hwndTabPage, GWL_USERDATA, pageId) rval = GetClientRect(hwndTabControl, tabRect) rval = SendMessage (hwndTabControl, TCM_ADJUSTRECT, FALSE, LOC(tabRect)) point%x = tabRect%left point%y = tabRect%top rval = MapWindowPoints(hwndTabControl, hwnd, point, 1) rval = SetWindowPos (hwndTabPage, HWND_TOP, point%x, point%y, 0, 0, & IOR(SWP_NOACTIVATE, SWP_NOSIZE)) IF (position == 1) THEN rval = ShowWindow(hwndTabPage, SW_SHOW) ELSE rval = ShowWindow(hwndTabPage, SW_HIDE) END IF END IF END FUNCTION TabControlAddPage