[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

MDI Child Frame with no system exit button

Posted on 1999-11-23
5
Medium Priority
?
304 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:leigh2
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
captainkirk earned 150 total points
ID: 2229829
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
 
LVL 2

Expert Comment

by:basant
ID: 2230234
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
 

Author Comment

by:leigh2
ID: 2231216
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
 

Author Comment

by:leigh2
ID: 2231221
Thanks this looks like it will work fine.  Do you know how I could tell what window not to close?
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2231773
thanks,leigh2....
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question