How can i maximized first default view, at MDI Mode.
Hi, everyone.
I appreciated your interest.
Now, the problem is just like this;
I created a project, in MDI mode with View inherited from CRecordView.
I implented those codes to maximize a first default view which is displayed
at running the project. I overrided OnActivateView like this:
void CTraceView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
{
// TODO: Add your specialized code here and/or call the base class
CRecordView::OnActivateView(bActivate, pActivateView, pDeactiveView);
pFrame= (CMDIFrameWnd*) AfxGetApp()->m_pMainWnd;
pChild= (CMDIChildWnd*) pFrame->GetActiveFrame();
pChild->MDIMaximize();
}
The problem is that: while i am running this EXE file, there is no error. but
after i terminate this runned EXE program, a error message dialog happens.
What's may be the bug. When I deleted (pChild->MDIMaxmize() ) , there was no
that problem.
please help me.... :)
Re: How can i maximized first default view, at MDI Mode.
You can change the child frame window's style to the following:
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);
}
All child frame windows will have maximized view. If you just want the first view to be maximized, just use a flag in the function.
Hope this will help. Good luck.
Allen
Re: How can i maximized first default view, at MDI Mode.
Thanks, Allen.
It worked, but differs a little from what i wanted.
I'd like to expand a window just like as i clicks a maximizing button in a view.
cs|WS_MAXMIZE results like this;
----------------------------------------------
| [trace 1] (->this is main Frame menu. )
| File Edit
--------------------------------------------
******************************************
* Trace1 (->this is chiled apps doc name.
******************************************
*
*/// this area is child's.
*
*
*********************************************
-----------------------------------------------
But i want it like this. (fully maximized and no child windows outline.)
----------------------------------------------
| [trace 1] (->this is main Frame menu. )
| File Edit
--------------------------------------------
This is Child's -> Note difference from above.
No child window's outline.
-----------------------------------------------
Geese...... :)
Re: How can i maximized first default view, at MDI Mode.
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::ActivateFrame(int nCmdShow)
{
//old:/*!CMDIChildWnd::ActivateFrame(nCmdShow);*/
CMDIChildWnd::ActivateFrame(SW_SHOWMAXIMIZED);//new
}
//http://members.xoom.com/jauming/
//[email protected]
Re: How can i maximized first default view, at MDI Mode.
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::ActivateFrame(int nCmdShow)
{
//old:/*!CMDIChildWnd::ActivateFrame(nCmdShow);*/
CMDIChildWnd::ActivateFrame(SW_SHOWMAXIMIZED);//new
}
//http://members.xoom.com/jauming/
//[email protected]
Re: How can i maximized first default view, at MDI Mode.
Yahoo!!!
It Worked COMPACTLY!
Thanks Kevin.... sincerely. :)