osi-sys
asked on
Maximize MDI Child window when Main window is maximized
Hello,
I am working with MDI application. When I maximize my main window, my child windows should also be maximized. Can anyone please help me to do this?
Thanks
osi-sys
I am working with MDI application. When I maximize my main window, my child windows should also be maximized. Can anyone please help me to do this?
Thanks
osi-sys
ASKER
Hi roshmon
Thanks for your help.
I did not remove the SYSMENU form CChildFrame as user should be given the option for minimising and maximizing the child window.
Hence I wrote only this part
void CChildFrame::ActivateFrame (int nCmdShow)
{
if (nCmdShow == -1)
nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFram e(nCmdShow );
}
This works fine when the application is started, I am showing main window in maximize mode initially. So child frame also is maximized. But when I click change the main window size and again maximize the main window, the child frame window is not getting maximized.
Can you please suggest how to proceed further?
Thanks
Madhavi
Thanks for your help.
I did not remove the SYSMENU form CChildFrame as user should be given the option for minimising and maximizing the child window.
Hence I wrote only this part
void CChildFrame::ActivateFrame
{
if (nCmdShow == -1)
nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFram
}
This works fine when the application is started, I am showing main window in maximize mode initially. So child frame also is maximized. But when I click change the main window size and again maximize the main window, the child frame window is not getting maximized.
Can you please suggest how to proceed further?
Thanks
Madhavi
Hi Madhavi,
override CMainFrame's ActivateFrame and call active child frame's SHowWindow(SW_SHOWMAXIMIZE )
~Roshan
override CMainFrame's ActivateFrame and call active child frame's SHowWindow(SW_SHOWMAXIMIZE
~Roshan
ASKER
Hi Roshan,
ActivateFrame handler of CMainFrame is not called at all. I checked using a messagebox.
ActivateFrame handler of CMDIChildWnd is called only once when new child view is craeted from File ->new .
I want my childd window to be maximized whenever Mainframe window is maximized.
Can you please suggest how to proceed further?
Thanks
Madhavi
ActivateFrame handler of CMainFrame is not called at all. I checked using a messagebox.
ActivateFrame handler of CMDIChildWnd is called only once when new child view is craeted from File ->new .
I want my childd window to be maximized whenever Mainframe window is maximized.
Can you please suggest how to proceed further?
Thanks
Madhavi
hi,
can u make little bit clear, itz working for me..i tried resizing of main frame and maximiz...child is also maximizing...
~Roshan
can u make little bit clear, itz working for me..i tried resizing of main frame and maximiz...child is also maximizing...
~Roshan
ASKER
Hi Roshan
void CChildFrame::ActivateFrame (int nCmdShow)
{
if (nCmdShow == -1)
nCmdShow = SW_SHOWMAXIMIZED;
AfxMessageBox(_TEXT("Activ e-------Ch ild"));
CMDIChildWnd::ActivateFram e(nCmdShow );
}
void CMainFrame::ActivateFrame( int nCmdShow)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp() ->m_pMainW nd;
CChildFrame *pChild = (CChildFrame *) pFrame->GetActiveFrame();
pChild->ShowWindow(SW_MAXI MIZE);
AfxMessageBox(_TEXT("Activ e --Frame"));
CMDIFrameWnd::ActivateFram e(nCmdShow );
}
I added the above code. For me ActivateFrame of CMainFrame is not getting called.
Madhavi
void CChildFrame::ActivateFrame
{
if (nCmdShow == -1)
nCmdShow = SW_SHOWMAXIMIZED;
AfxMessageBox(_TEXT("Activ
CMDIChildWnd::ActivateFram
}
void CMainFrame::ActivateFrame(
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()
CChildFrame *pChild = (CChildFrame *) pFrame->GetActiveFrame();
pChild->ShowWindow(SW_MAXI
AfxMessageBox(_TEXT("Activ
CMDIFrameWnd::ActivateFram
}
I added the above code. For me ActivateFrame of CMainFrame is not getting called.
Madhavi
Only "void CChildFrame::ActivateFrame (int nCmdShow)" is needed, thatz working for me
~R
~R
ASKER
Hi
It's only working for the first time at application startup. Later when I resize the child window, and then resize the main window i.e maximize it, child window is not maximized.
Can you please post me the application to jmadhavi@yahoo.com
Thanks
Madhavi
It's only working for the first time at application startup. Later when I resize the child window, and then resize the main window i.e maximize it, child window is not maximized.
Can you please post me the application to jmadhavi@yahoo.com
Thanks
Madhavi
oh now i got... u r resizing the child window after that right?
Map CmainFrame's WM_SIZE (ie. OnSize) and try the skelton code
CView *pView = GetActiveView();
pView->GetParent()->ShowWi ndow(SW_SH OWMAXIMIZE );
this is just a rought code may need some modification...
btw r u from india?
~Roshan
Map CmainFrame's WM_SIZE (ie. OnSize) and try the skelton code
CView *pView = GetActiveView();
pView->GetParent()->ShowWi
this is just a rought code may need some modification...
btw r u from india?
~Roshan
ASKER
Hi,
Yes I am from India.]
yes I am resizing both the child window and parent window i.e Mainframe window after that . I am trying, but still I'm unable to do it.
Can you please let me know if you find any solution.
Thanks
Madhavi
Yes I am from India.]
yes I am resizing both the child window and parent window i.e Mainframe window after that . I am trying, but still I'm unable to do it.
Can you please let me know if you find any solution.
Thanks
Madhavi
ASKER
Hi
I could get it.
Thanks for your help.
Madhavi
I could get it.
Thanks for your help.
Madhavi
map WM_SIZE of CMainFrame, and try following code
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIFrameWnd::OnSize(nType , cx, cy);
CFrameWnd *pFrame = GetActiveFrame();
if ( pFrame )
pFrame->ShowWindow(SW_MAXI MIZE);
}
~Roshan
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIFrameWnd::OnSize(nType
CFrameWnd *pFrame = GetActiveFrame();
if ( pFrame )
pFrame->ShowWindow(SW_MAXI
}
~Roshan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)
where in india?
~R
where in india?
~R
ASKER
Hyderabad
:-)
BOOL CChildFrame::PreCreateWind
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~WS_SYSMENU;
if( !CMDIChildWnd::PreCreateWi
return FALSE;
return TRUE;
}
void CChildFrame::ActivateFrame
{
if (nCmdShow == -1)
nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFram
}
Good Luck
~R