I found the tab control quite confusing so this is what I did instead. I created separate dialog templates...one for each tab in my control. Then I created them from the OnInitialUpdate() virtual function of CMyFormView... the code goes something like this...
in the MyFormView.h header declare the variables
CMyPage1 m_Page1;
CMyPage2 m_Page2;;
CMyPage3 m_Page3;
CPropertySheet* pSheet;
Code:
void CMyFormView::OnInitialUpdate()
{
...this call should really be made from the OnCreate message handler
....
CreateTabControl();
}
void CMyFormView::CreateTabControl()
{
pPropertySheet = new CPropertySheet( "My Tab", this, 0);
pPropertySheet->AddPage( &m_Page1 );
pPropertySheet->AddPage( &m_Page2 );
pPropertySheet->AddPage( &m_Page3 );
pPropertySheet->Create( this, WS_CHILD | WS_VISIBLE );
//** Create a static text with the resource editor where you
//** would like to position your control and bind a CStatic
//** member to it... you must change the default idd from
//** IDC_STATIC to IDC_STATIC1 or something more meaningfull
CRect r;
m_staticPlaceHolder.GetWindowRect( &r );
ScreenToClient( &r );
//** reposition the window where you want it.....
pPropertySheet->SetWindowPos( pPropertySheet,
NULL, r.top, r.left, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
}
Remember that the page members must be your own classes derived from the CPropertyPage class... to create them with the correct property settings from the resource editor insert new resource ... select DIALOG... then IDD_PROPERTYPAGE_MEDIUM.. you can always resize it... then from the class wizard create the class as you normally would for a dialog but remember to change the base class to CPropertyPage instead of CDialog.... this will add all the necessary code to get you started... and a very important point to remember is that you cannot access the property pages except for the one selected by default until they have been selected by the user or you have set the focus on the through the property sheet member SetActivePage(...)
I hope this helps... I found this much easier to implement than the tab control.....