First, you're calling GetClientRect() in the wrong context. GetClientRect() gets "this" windows client rectangle, not the parents'. If you want to get the parents' client rectangle (the framework as you call it), in the context of the child, then call GetParent()->GetClientRect(). The way I would do what you're trying to do is the following: 1. Using the ClassWizard, add a WM_SIZE and WM_CREATE message handler to your View class, or 2. alternatively add ON_WM_SIZE() and ON_WM_CREATE() to your View class's message map and add the following overrides to your View class's header file:
afx\_msg void OnSize(UINT nType, int cx, int cy);
afx\_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
4. add the following code (if you used the ClassWizard to add the WM_SIZE and WM_CREATE handlers, then cut and paste the code as appropriate).
void CMyTabExampleView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
m\_myTabs.MoveWindow(0, 0, cx, cy);
// TODO: Add your message handler code here
}
int CMyTabExampleView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rect;
GetClientRect(&rect);
m\_myTabs.Create(0, rect, this, 9999);
m\_myTabs.ShowWindow(SW\_SHOW);
return 0;
}
Of course, the style and ID of the "m_myTabs" window needs to be what you need them to be. Adjust accordingly. Hope this helps. Good luck. :-D Call if you need more help.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun