//--------------------------------------------------------------- // Purpose: //--------------------------------------------------------------- BOOL CEntityDialog::OnInitDialog() { if( !CDialogEx::OnInitDialog() ) return FALSE; //Create copy of editable entity m_oldEntity = GetActiveDocument()->GetSelectedEntity(0); m_newEntity = m_oldEntity->Clone(); Assert( m_oldEntity && m_newEntity ); GetActiveDocument()->GetEntityList()->ReplaceEntity( m_oldEntity, m_newEntity ); GetActiveDocument()->SelectSingleEntity( m_newEntity ); m_dialogClassInfo.SetEditEntity(m_newEntity); //Get Tab Control CTabCtrl *pTabCtrl = (CTabCtrl*)GetDlgItem(IDC_TAB1); //Create Tab Content dialog and adjust m_dialogClassInfo.Create(IDD_ENTITY_CLASS_INFO, pTabCtrl); TCITEM tcItem; tcItem.mask = TCIF_TEXT | TCIF_PARAM; tcItem.pszText = _T("Class Info"); tcItem.lParam = (LPARAM)&m_dialogClassInfo; pTabCtrl->InsertItem(0, &tcItem); RECT wndrect; GetClientRect(&wndrect); wndrect.top -= 15; wndrect.bottom -= 30; pTabCtrl->AdjustRect( FALSE, &wndrect ); pTabCtrl->MoveWindow( &wndrect ); CRect rect; pTabCtrl->GetItemRect(0, &rect); m_dialogClassInfo.SetWindowPos(NULL, rect.left, rect.bottom + 1, wndrect.right-wndrect.left-10, wndrect.bottom-wndrect.top-30, /*SWP_NOSIZE |*/ SWP_NOZORDER ); m_dialogClassInfo.ShowWindow(SW_SHOW); return TRUE; }
BOOL CMainTabDlg::OnInitDialog() { CRect r; TC_ITEM item; CString strTab; UINT nTabID[3]= {IDS_TAB_MAIN_CONFIGURE,IDS_TAB_MAIN_HISTORY,IDS_TAB_MAIN_PREFERENCES}; CDialog::OnInitDialog(); memset (&item, 0, sizeof (item)); item.mask = TCIF_TEXT|TCIF_IMAGE; item.cchTextMax = 32; item.iImage = -1; CTabCtrl * ptab = (CTabCtrl * )GetDlgItem(IDC_TAB1); ASSERT(ptab); ptab->GetWindowRect (r); ScreenToClient (r); m_dlgPadding.cx = r.left; m_dlgPadding.cy = r.top; CButton* pButton1= (CButton*)GetDlgItem(IDC_BUTTON1); ASSERT (pButton1); pButton1->GetWindowRect (r); ScreenToClient (r); m_buttonPadding.cx = r.right; m_buttonPadding.cy = r.bottom; int nTab = 2; #if defined (OIDSK) nTab = 2; #endif for (int i=0; i<nTab; i++) { strTab.LoadString (nTabID [i]); item.pszText = (LPTSTR)(LPCTSTR)strTab; ptab->InsertItem (i, &item); } if (m_pCurDlg) m_pCurDlg->ShowWindow (SW_HIDE); CTabCtrl* pTab = (CTabCtrl*) GetDlgItem(IDC_TAB1); int nsel = pTab->GetCurSel(); switch (nsel) { case PANE_CONFIG: if (!m_pConfigDlg) { m_pConfigDlg = new CConfigDlg(pTab); m_pConfigDlg->Create(IDD_CONFIG,pTab); } m_pCurDlg= m_pConfigDlg; break; case PANE_HISTORY: if (!m_pHistDlg) { m_pHistDlg = new CHistDlg(pTab); m_pHistDlg->Create(IDD_HISTORY,pTab); } m_pCurDlg= m_pHistDlg; break; case PANE_PREFERENCES: if (!m_pPrefDlg) { m_pPrefDlg = new CPrefDlg(pTab); m_pPrefDlg->Create(IDD_PREFERENCES,pTab); } m_pCurDlg= m_pPrefDlg; break; } if (m_pCurDlg) { CRect r; pTab->GetClientRect (r); pTab->AdjustRect (FALSE, r); m_pCurDlg->MoveWindow(r); m_pCurDlg->ShowWindow(SW_SHOW); } SHOSTINFO CurInfo; VCBFGetHostInfos(&CurInfo); CStatic* pStatic = (CStatic*)GetDlgItem(IDC_STATIC_NAME_INSTALL); pStatic->SetWindowText((LPCTSTR)CurInfo.ii_installation_name); pStatic = (CStatic*)GetDlgItem(IDC_STATIC_INSTALL); pStatic->SetWindowText((LPCTSTR)CurInfo.ii_installation); pStatic = (CStatic*)GetDlgItem(IDC_STATIC_IISYSTEM_NAME); pStatic->SetWindowText((LPCTSTR)CurInfo.ii_system_name); pStatic = (CStatic*)GetDlgItem(IDC_STATIC_II_SYSTEM); pStatic->SetWindowText((LPCTSTR)CurInfo.ii_system); pStatic = (CStatic*)GetDlgItem(IDC_STATIC_HOST); pStatic->SetWindowText((LPCTSTR)CurInfo.host); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CInstrumentEditDlg::InsertPane(CInstrumentEditPanel *pPanel, bool Show) { CRect Rect, ParentRect; CTabCtrl *pTabControl = static_cast<CTabCtrl*>(GetDlgItem(IDC_INST_TAB)); pPanel->SetInstrumentManager(m_pInstManager); // // // pTabControl->GetWindowRect(&ParentRect); pTabControl->InsertItem(m_iPanels, pPanel->GetTitle()); pPanel->Create(pPanel->GetIDD(), this); pPanel->GetWindowRect(&Rect); Rect.MoveToXY(ParentRect.left - Rect.left + DPI::SX(1), ParentRect.top - Rect.top + DPI::SY(21)); Rect.bottom -= DPI::SY(2); Rect.right += DPI::SX(1); pPanel->MoveWindow(Rect); pPanel->ShowWindow(Show ? SW_SHOW : SW_HIDE); if (Show) { pTabControl->SetCurSel(m_iPanels); pPanel->SetFocus(); m_pFocusPanel = pPanel; } m_pPanels[m_iPanels++] = pPanel; }
BOOL CNetSettingDlg::OnInitDialog() { CDialog::OnInitDialog(); CTabCtrl* tabCtrl = (CTabCtrl*)GetDlgItem(IDC_TAB1); if(tabCtrl) { tabCtrl->InsertItem(0, _T("Á¬½Ó²ÎÊý")); } //read and get the parameters from configuration file ifstream fin(g_ConfPath); if(fin.good()) { fin >> m_Conf; TiXmlElement* pRemote = TiXmlHandle(&m_Conf).FirstChildElement(ConfTags::CONF_ROOT).FirstChildElement(ConfTags::REMOTE).Element(); if(pRemote) { //get the IP address string ip_addr = pRemote->Attribute(ConfTags::REMOTE_IP); DWORD dwIP = ntohl(inet_addr(ip_addr.c_str())); m_IPAddr.SetWindowText(CString(ip_addr.c_str())); //get the port string port = pRemote->Attribute(ConfTags::REMOTE_PORT); m_Port.SetWindowText(CString(port.c_str())); //get the account string account = pRemote->Attribute(ConfTags::ACCOUNT); m_Account.SetWindowText(CString(account.c_str())); //set the initial pwd to a random integer char tmp[64]; sprintf_s(tmp, 64, "%d", 100000 + rand() % 900000); m_InitPwd = tmp; m_Pwd.SetWindowText(CString(m_InitPwd.c_str())); } }
BOOL CuDlgCacheTab::OnInitDialog() { CDialog::OnInitDialog(); // // Initialize the tab control CRect r; TC_ITEM item; CString strTab; UINT nTabID[2]= {IDS_TAB_CONFRIGHT_PARAMETERS, IDS_TAB_CONFRIGHT_DERIVED}; memset (&item, 0, sizeof (item)); item.mask = TCIF_TEXT; item.cchTextMax = 32; item.iImage = -1; CTabCtrl* pTab = (CTabCtrl*)GetDlgItem(IDC_TAB1); ASSERT(pTab); for (int i=0; i<2; i++) { strTab.LoadString (nTabID [i]); item.pszText = (LPTSTR)(LPCTSTR)strTab; pTab->InsertItem (i, &item); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CTreePropSheet::OnInitDialog() { if (m_bTreeViewMode) { // be sure, there are no stacked tabs, because otherwise the // page caption will be to large in tree view mode EnableStackedTabs(FALSE); // Initialize image list. if (m_DefaultImages.GetSafeHandle()) { IMAGEINFO ii; m_DefaultImages.GetImageInfo(0, &ii); if (ii.hbmImage) DeleteObject(ii.hbmImage); if (ii.hbmMask) DeleteObject(ii.hbmMask); m_Images.Create(ii.rcImage.right-ii.rcImage.left, ii.rcImage.bottom-ii.rcImage.top, ILC_COLOR32|ILC_MASK, 0, 1); } else m_Images.Create(16, 16, ILC_COLOR32|ILC_MASK, 0, 1); } // perform default implementation BOOL bResult = CPropertySheet::OnInitDialog(); if (!m_bTreeViewMode) // stop here, if we would like to use tabs return bResult; // Get tab control... CTabCtrl *pTab = GetTabControl(); if (!IsWindow(pTab->GetSafeHwnd())) { ASSERT(FALSE); return bResult; } // ... and hide it pTab->ShowWindow(SW_HIDE); pTab->EnableWindow(FALSE); // Place another (empty) tab ctrl, to get a frame instead CRect rectFrame; pTab->GetWindowRect(rectFrame); ScreenToClient(rectFrame); m_pFrame = CreatePageFrame(); if (!m_pFrame) { ASSERT(FALSE); AfxThrowMemoryException(); } m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF); m_pFrame->ShowCaption(m_bPageCaption); // Lets make place for the tree ctrl const int nTreeWidth = m_nPageTreeWidth; const int nTreeSpace = 5; CRect rectSheet; GetWindowRect(rectSheet); rectSheet.right+= nTreeWidth; SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER|SWP_NOMOVE); CenterWindow(); MoveChildWindows(nTreeWidth, 0); // Lets calculate the rectangle for the tree ctrl CRect rectTree(rectFrame); rectTree.right = rectTree.left + nTreeWidth - nTreeSpace; // calculate caption height CTabCtrl wndTabCtrl; wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234); wndTabCtrl.InsertItem(0, _T("")); CRect rectFrameCaption; wndTabCtrl.GetItemRect(0, rectFrameCaption); wndTabCtrl.DestroyWindow(); m_pFrame->SetCaptionHeight(rectFrameCaption.Height()); // if no caption should be displayed, make the window smaller in // height if (!m_bPageCaption) { // make frame smaller m_pFrame->GetWnd()->GetWindowRect(rectFrame); ScreenToClient(rectFrame); rectFrame.top+= rectFrameCaption.Height(); m_pFrame->GetWnd()->MoveWindow(rectFrame); // move all child windows up MoveChildWindows(0, -rectFrameCaption.Height()); // modify rectangle for the tree ctrl rectTree.bottom-= rectFrameCaption.Height(); // make us smaller CRect rect; GetWindowRect(rect); rect.top+= rectFrameCaption.Height()/2; rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2; if (GetParent()) GetParent()->ScreenToClient(rect); MoveWindow(rect); } // finally create tht tree control const DWORD dwTreeStyle = TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS; m_pwndPageTree = CreatePageTreeObject(); if (!m_pwndPageTree) { ASSERT(FALSE); AfxThrowMemoryException(); } ((CWnd*)m_pwndPageTree)->CreateEx( WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, _T("SysTreeView32"), _T("PageTree"), WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, rectTree, this, s_unPageTreeId); //// MFC7-support here (Thanks to Rainer Wollgarten) //#if _MFC_VER >= 0x0700 //{ // m_pwndPageTree->CreateEx( // WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, // WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, // rectTree, this, s_unPageTreeId); //} //#else //{ // m_pwndPageTree->CreateEx( // WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, // _T("SysTreeView32"), _T("PageTree"), // WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, // rectTree, this, s_unPageTreeId); //} //#endif if (m_bTreeImages) { m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL); m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE); } // Fill the tree ctrl RefillPageTree(); // Select item for the current page if (pTab->GetCurSel() > -1) SelectPageTreeItem(pTab->GetCurSel()); // Expand all tree items HTREEITEM hCurrent = m_pwndPageTree->GetNextItem(NULL, TVGN_FIRSTVISIBLE); while (hCurrent != NULL) { m_pwndPageTree->Expand(hCurrent, TVE_EXPAND); hCurrent = m_pwndPageTree->GetNextItem(hCurrent, TVGN_NEXT); } return bResult; }
BOOL CTreePropSheet::OnInitDialog() { if (m_bTreeViewMode) { // be sure, there are no stacked tabs, because otherwise the // page caption will be to large in tree view mode EnableStackedTabs(FALSE); // Initialize image list. if (m_DefaultImages.GetSafeHandle()) { IMAGEINFO ii; m_DefaultImages.GetImageInfo(0, &ii); m_Images.Create(ii.rcImage.right - ii.rcImage.left, ii.rcImage.bottom - ii.rcImage.top, ILC_COLOR32 | ILC_MASK, 0, 1); } else m_Images.Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1); } // perform default implementation BOOL bResult = CPropertySheet::OnInitDialog(); if (!m_bTreeViewMode) // stop here, if we would like to use tabs return bResult; // Get tab control... CTabCtrl* pTab = GetTabControl(); if (!IsWindow(pTab->GetSafeHwnd())) { ASSERT(FALSE); return bResult; } HighColorTab::UpdateImageList(*this); // ... and hide it pTab->ShowWindow(SW_HIDE); pTab->EnableWindow(FALSE); // Place another (empty) tab ctrl, to get a frame instead CRect rectFrame; pTab->GetWindowRect(rectFrame); ScreenToClient(rectFrame); m_pFrame = CreatePageFrame(); if (!m_pFrame) { ASSERT(FALSE); AfxThrowMemoryException(); } m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF); m_pFrame->ShowCaption(m_bPageCaption); // Lets make place for the tree ctrl const int nTreeWidth = m_nPageTreeWidth; const int nTreeSpace = 5; CRect rectSheet; GetWindowRect(rectSheet); rectSheet.right += nTreeWidth; SetWindowPos(NULL, 0, 0, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER | SWP_NOMOVE); CenterWindow(); MoveChildWindows(nTreeWidth, 0); // Lets calculate the rectangle for the tree ctrl CRect rectTree(rectFrame); rectTree.right = rectTree.left + nTreeWidth - nTreeSpace; // calculate caption height CTabCtrl wndTabCtrl; wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234); wndTabCtrl.InsertItem(0, _T("")); CRect rectFrameCaption; wndTabCtrl.GetItemRect(0, rectFrameCaption); wndTabCtrl.DestroyWindow(); m_pFrame->SetCaptionHeight(rectFrameCaption.Height()); // if no caption should be displayed, make the window smaller in // height if (!m_bPageCaption) { // make frame smaller m_pFrame->GetWnd()->GetWindowRect(rectFrame); ScreenToClient(rectFrame); rectFrame.top+= rectFrameCaption.Height(); m_pFrame->GetWnd()->MoveWindow(rectFrame); // move all child windows up MoveChildWindows(0, -rectFrameCaption.Height()); // modify rectangle for the tree ctrl rectTree.bottom-= rectFrameCaption.Height(); // make us smaller CRect rect; GetWindowRect(rect); rect.top+= rectFrameCaption.Height()/2; rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2; if (GetParent()) GetParent()->ScreenToClient(rect); MoveWindow(rect); // Need to center window again to reflect the missing caption bar (noticeable on 640x480 resolutions) CenterWindow(); } // finally create the tree control //const DWORD dwTreeStyle = TVS_SHOWSELALWAYS/*|TVS_TRACKSELECT*/|TVS_HASLINES/*|TVS_LINESATROOT*/|TVS_HASBUTTONS; // As long as we don't use sub pages we apply the 'TVS_FULLROWSELECT' style for a little more user convinience. const DWORD dwTreeStyle = TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | TVS_NOHSCROLL; m_pwndPageTree = CreatePageTreeObject(); if (!m_pwndPageTree) { ASSERT(FALSE); AfxThrowMemoryException(); } // MFC7-support here (Thanks to Rainer Wollgarten) #if _MFC_VER >= 0x0700 { // Using 'CTreeCtrl::CreateEx' (and it's indeed a good idea to call this one), results in // flawed window styles (border is missing) when running under WinXP themed.. ??? //m_pwndPageTree->CreateEx( // WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, // WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, // rectTree, this, s_unPageTreeId); // Feel free to explain to me why we need to call CWnd::CreateEx to get the proper window style // for the tree view control when running under WinXP. Look at CTreeCtrl::CreateEx and CWnd::CreateEx to // see the (minor) difference. However, this could create problems in future MFC versions.. m_pwndPageTree->CWnd::CreateEx( WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, WC_TREEVIEW, _T("PageTree"), WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, rectTree, this, s_unPageTreeId); } #else { m_pwndPageTree->CreateEx( WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, _T("SysTreeView32"), _T("PageTree"), WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, rectTree, this, s_unPageTreeId); } #endif // This treeview control was created dynamically, thus it does not derive the font // settings from the parent dialog. Need to set the font explicitly so that it fits // to the font which is used for the property pages. m_pwndPageTree->SendMessage(WM_SETFONT, (WPARAM)AfxGetMainWnd()->GetFont()->m_hObject, TRUE); m_pwndPageTree->SetItemHeight(m_pwndPageTree->GetItemHeight() + 6); if (m_bTreeImages) { m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL); m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE); } // Fill the tree ctrl RefillPageTree(); // Select item for the current page if (pTab->GetCurSel() > -1) SelectPageTreeItem(pTab->GetCurSel()); return bResult; }
BOOL CTreePropSheetBase::OnInitDialog() { if (m_bTreeViewMode && !IsWizardMode() ) { // Fix suggested by Przemek Miszczuk // http://www.codeproject.com/property/TreePropSheetEx.asp?msg=1024928#xx1024928xx TreePropSheet::CIncrementScope RefillingPageTreeContentGuard(m_nRefillingPageTreeContent ); // be sure, there are no stacked tabs, because otherwise the // page caption will be to large in tree view mode EnableStackedTabs(FALSE); // Initialize image list. if (m_DefaultImages.GetSafeHandle()) { IMAGEINFO ii; m_DefaultImages.GetImageInfo(0, &ii); if (ii.hbmImage) DeleteObject(ii.hbmImage); if (ii.hbmMask) DeleteObject(ii.hbmMask); m_Images.Create(ii.rcImage.right-ii.rcImage.left, ii.rcImage.bottom-ii.rcImage.top, ILC_COLOR32|ILC_MASK, 0, 1); } else m_Images.Create(16, 16, ILC_COLOR32|ILC_MASK, 0, 1); } // perform default implementation BOOL bResult = CPropertySheet::OnInitDialog(); // If in wizard mode, stop here. if( IsWizardMode() ) return bResult; // Get tab control... CTabCtrl *pTab = GetTabControl(); if (!IsWindow(pTab->GetSafeHwnd())) { ASSERT(FALSE); return bResult; } // HighColorTab::UpdateImageList to change the internal image list to 24 bits colors) HighColorTab::UpdateImageList( *this ); // If not in tree mode, stop here. if (!m_bTreeViewMode) // stop here, if we would like to use tabs return bResult; // ... and hide it pTab->ShowWindow(SW_HIDE); pTab->EnableWindow(FALSE); // Place another (empty) tab ctrl, to get a frame instead CRect rectFrame; pTab->GetWindowRect(rectFrame); ScreenToClient(rectFrame); m_pFrame = CreatePageFrame(); if (!m_pFrame) { ASSERT(FALSE); AfxThrowMemoryException(); } m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF); m_pFrame->ShowCaption(m_bPageCaption); // Lets make place for the tree ctrl const int nTreeWidth = m_nPageTreeWidth; CRect rectSheet; GetWindowRect(rectSheet); rectSheet.right+= nTreeWidth; SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER|SWP_NOMOVE); CenterWindow(); MoveChildWindows(nTreeWidth, 0); // Lets calculate the rectangle for the tree ctrl CRect rectTree(rectFrame); rectTree.right = rectTree.left + nTreeWidth - m_nSeparatorWidth; // calculate caption height CTabCtrl wndTabCtrl; wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234); wndTabCtrl.InsertItem(0, _T("")); CRect rectFrameCaption; wndTabCtrl.GetItemRect(0, rectFrameCaption); wndTabCtrl.DestroyWindow(); m_pFrame->SetCaptionHeight(rectFrameCaption.Height()); // if no caption should be displayed, make the window smaller in // height if (!m_bPageCaption) { // make frame smaller m_pFrame->GetWnd()->GetWindowRect(rectFrame); ScreenToClient(rectFrame); rectFrame.top+= rectFrameCaption.Height(); m_pFrame->GetWnd()->MoveWindow(rectFrame); // move all child windows up MoveChildWindows(0, -rectFrameCaption.Height()); // modify rectangle for the tree ctrl rectTree.bottom-= rectFrameCaption.Height(); // make us smaller CRect rect; GetWindowRect(rect); rect.top+= rectFrameCaption.Height()/2; rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2; if (GetParent()) GetParent()->ScreenToClient(rect); MoveWindow(rect); CenterWindow(); } // finally create the tree control const DWORD dwTreeStyle = TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS; m_pwndPageTree = CreatePageTreeObject(); if (!m_pwndPageTree) { ASSERT(FALSE); AfxThrowMemoryException(); } // MFC7-support here (Thanks to Rainer Wollgarten) // YT: Cast tree control to CWnd and calls CWnd::CreateEx in all cases (VC 6 and7). ((CWnd*)m_pwndPageTree)->CreateEx( WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, _T("SysTreeView32"), _T("PageTree"), WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, rectTree, this, s_unPageTreeId); if (m_bTreeImages) { m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL); m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE); } // TreePropSheetEx: Fix refresh problem. // Fill the tree ctrl { TreePropSheet::CWindowRedrawScope WindowRedrawScope( m_pwndPageTree, true ); // Populate the tree control. RefillPageTree(); // Expand the tree if necessary. if( IsAutoExpandTree() ) { ExpandTreeItem( m_pwndPageTree, m_pwndPageTree->GetRootItem(), TVE_EXPAND ); } // Select item for the current page if (pTab->GetCurSel() > -1) SelectPageTreeItem(pTab->GetCurSel()); } return bResult; }