MDI Child Frame with no system exit button

I have a MDI application in which I have multiple views.  However upon loading the application a default view is displayed and I don't want the user to be able to close this view.  Is it possible to remove the "x" exit button from the frame?
leigh2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

captainkirkCommented:
You might better override the OnClose() method (perhaps in the CMDIChildWnd derived class) and check to see if the current view is the one you want, and if so, do not allow the close processing to continue (don't call the base class OnClose() )...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
basantCommented:
Yes change the Child View
Style to WM_NOCLOSE.

May be by overloading PreCreateWindow

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    // Create a window without min/max buttons or sizable border
    cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER | WM_NOCLOSE;

    // Size the window to 1/3 screen size and center it
    cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 3;
    cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 3;
    cs.y = ((cs.cy * 3) - cs.cy) / 2;
    cs.x = ((cs.cx * 3) - cs.cx) / 2;

    // Call the base-class version
    return CFrameWnd::PreCreateWindow(cs);
}


0
leigh2Author Commented:
This method was a good idea but unfortunately did not work.  Thanks for your help anyways.  You cannot create a child with ~WM_CLOSE.

                    Regards, Leigh
0
leigh2Author Commented:
Thanks this looks like it will work fine.  Do you know how I could tell what window not to close?
0
captainkirkCommented:
thanks,leigh2....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.