Click to See Complete Forum and Search --> : Views reverting to defaults in .rc


rcass
July 22nd, 1999, 09:12 AM
I have an application which uses a single document type and a single view type. When a new document is added to the application with a new view, the contents of the old view revert to the sizes and layouts of the default set in the .rc file, also when I click on a current view, the view reverts even though it has been re-sized. How can I prevent this from happening.All replies are greatly appreciated and will be summed. Here are some code snippets from places I think might be relevant :

App::InitInstance () {
...
m_nCmdShow = SW_SHOWMAXIMIZED;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->SetWindowText(m_servicename);
pMainFrame->UpdateWindow();
}

View::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL)
pActiveItem->SetItemRects();
}

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
| FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;

return CMDIChildWnd::PreCreateWindow(cs);
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
| WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;

return CMDIFrameWnd::PreCreateWindow(cs);
}