Click to See Complete Forum and Search --> : How can i maximized first default view, at MDI Mode.


JD Charles
March 31st, 1999, 08:58 PM
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.... :)

Allen
March 31st, 1999, 09:54 PM
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

JD Charles
March 31st, 1999, 11:02 PM
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...... :)

Kevin
April 1st, 1999, 12:49 AM
/////////////////////////////////////////////////////////////////////////////

// CChildFrame message handlers


void CChildFrame::ActivateFrame(int nCmdShow)

{

//old:/*!CMDIChildWnd::ActivateFrame(nCmdShow);*/

CMDIChildWnd::ActivateFrame(SW_SHOWMAXIMIZED);//new

}


//http://members.xoom.com/jauming/

//jauming@yahoo.com

kevin
April 1st, 1999, 12:49 AM
/////////////////////////////////////////////////////////////////////////////

// CChildFrame message handlers


void CChildFrame::ActivateFrame(int nCmdShow)

{

//old:/*!CMDIChildWnd::ActivateFrame(nCmdShow);*/

CMDIChildWnd::ActivateFrame(SW_SHOWMAXIMIZED);//new

}


//http://members.xoom.com/jauming/

//jauming@yahoo.com

JD Charles
April 1st, 1999, 04:36 AM
Yahoo!!!


It Worked COMPACTLY!


Thanks Kevin.... sincerely. :)