bunwong
asked on
how to prevent a mdi child from closing?
how to prevent a mdi child from closig? i have tried disable the WS_SYSMENU but a chlid can still be closed by ctrl-f4.
thanks.
thanks.
u mean alt+F4, not Ctrl+F4
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Set CS_NOCLOSE window style for you child window
override WindowProc() as follow:
LRESULT WindowProc(
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
LRESULT CDynamicControlsDlg::Windo wProc(UINT uMsg,
WPARAM wParam,LPARAM lParam)
{
if(uMsg == WM_CLOSE)
return 0;
return CDialog::WindowProc(uMsg,w Param,lPar am);
}
good luck
LRESULT WindowProc(
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
LRESULT CDynamicControlsDlg::Windo
WPARAM wParam,LPARAM lParam)
{
if(uMsg == WM_CLOSE)
return 0;
return CDialog::WindowProc(uMsg,w
}
good luck
sorry, for child frame its should look like this:
LRESULT CChildFrame::WindowProc(UI NT uMsg,
WPARAM wParam,LPARAM lParam)
{
if(uMsg == WM_CLOSE)
return 0;
return CMDIChildWnd::WindowProc(u Msg,wParam ,lParam);
}
btw, when u press ALT+F4 the main frame receives the WM_CLOSE and shut down the application so u need to take this under consideration
LRESULT CChildFrame::WindowProc(UI
WPARAM wParam,LPARAM lParam)
{
if(uMsg == WM_CLOSE)
return 0;
return CMDIChildWnd::WindowProc(u
}
btw, when u press ALT+F4 the main frame receives the WM_CLOSE and shut down the application so u need to take this under consideration
ASKER
it works, i am amazed how simple it is. thanks MadYugoslav
Thanks.
>it works
yep, it works but how :)
user see the close button, press it and nothing happens. or even better, user can do nothing, no minimize, no maximaze.
The solution I proposed allows you to have close button but it's disabled and from that point it's clear that window can't be closed
yep, it works but how :)
user see the close button, press it and nothing happens. or even better, user can do nothing, no minimize, no maximaze.
The solution I proposed allows you to have close button but it's disabled and from that point it's clear that window can't be closed