Locked No save!

  • Friday, August 17, 2012 12:59 PM
     
     
    I need a method to stop the "Save changes... " prompt when my
    application closes.
     
    Any ideas?
     
    Steve
     
    --
    Neural Network Software.                     http://www.npsl1.com
    EasyNN-plus. Neural Networks plus.           http://www.easynn.com
    SwingNN.     Forecast with Neural Networks.  http://www.swingnn.com
    JustNN.      Just Neural Networks.           http://www.justnn.com
     
     

    npsl1

All Replies

  • Friday, August 17, 2012 1:27 PM
     
     

    One way of doing it:

    Override document's SaveModified, Do not call the base class, retun TRUE.


    JohnCz

  • Friday, August 17, 2012 1:56 PM
     
     

    I didn't get your question . If it's your module who is firing this save changes event in your app. If you are the one then Don't fire it.

    Thanks


    Rupesh Shukla

  • Friday, August 17, 2012 2:03 PM
     
     

    Try using OnSysCommand(...) / ON_WM_SYSCOMMAND in your mainframe class and handle the message for SC_CLOSE.  This occurs when you click on the 'X' control on the upper right corner of the title bar. 

    It's easy to implement...here's the link:

    http://msdn.microsoft.com/en-us/library/hh46df93(v=VS.80).aspx


    PAC


    • Edited by PACMAN_1 Friday, August 17, 2012 2:05 PM
    •  
  • Friday, August 17, 2012 2:35 PM
     
     

    If it's your module who is firing this save changes event in your app. If you are the one then Don't fire it.

    Thanks


    Rupesh Shukla

    Hi,

    From what I gather, this is MFC forum, so why did you mention firing events? MFC application is Win32 application and is using messages and message handlers not events.
    Event for Win32 application has completely different meaning from events used in .NET world.


    JohnCz

  • Friday, August 17, 2012 2:40 PM
     
     
    On Fri, 17 Aug 2012 13:56:50 +0000, Pintu Shukla wrote:
     
    >
    >
    >I didn't get your question . If it's your module who is firing this save changes event in your app. If you are the one then Don't fire it.
    >
    >Thanks
    >
    >
    >Rupesh Shukla
     
    I don't understand that. I haven't even got a mobile!
     
    Steve
     
    --
    Neural Network Software.                     http://www.npsl1.com
    EasyNN-plus. Neural Networks plus.           http://www.easynn.com
    SwingNN.     Forecast with Neural Networks.  http://www.swingnn.com
    JustNN.      Just Neural Networks.           http://www.justnn.com
     
     

    npsl1
  • Friday, August 17, 2012 2:42 PM
     
     Answered

    Try using OnSysCommand(...) / ON_WM_SYSCOMMAND in your mainframe class and handle the message for SC_CLOSE. 


    PAC


    Well, main frame object is not even (and it should not be) about document object.

    Views however in SDI/MDI application is tied to the document. Any change in the view data should notify document and set dirty flag. CEditView does it by default.

    Document has already implemented the way of handling saving changed data and the only thing to do (as I proposed) is to use virtual override in CDocument derived class to achieve desired result.

    Why bother with system messages?


    JohnCz

  • Friday, August 17, 2012 2:43 PM
     
     

    If it's your module who is firing this save changes event in your app. If you are the one then Don't fire it.

    Thanks


    Rupesh Shukla

    Hi,

    From what I gather, this is MFC forum, so why did you mention firing events? MFC application is Win32 application and is using messages and message handlers not events.
    Event for Win32 application has completely different meaning from events used in .NET world.


    JohnCz

    Lol Fire event mean how this Save As comes in the picture . And i am not saying any event i mean who raise this message.

    Thanks


    Rupesh Shukla


  • Friday, August 17, 2012 2:45 PM
     
     
    I don't understand that. I haven't even got a mobile!
    Steve

    Dude i am just trying to understand your question .Nothing else . So that i can provide you a proper answer .

    Thanks


    Rupesh Shukla

  • Sunday, August 19, 2012 9:01 PM
     
     

    Steve,

    Did you try my suggestion?

    >>Override document's SaveModified, Do not call the base class, retun TRUE.


    JohnCz