Solved

SaveModified in dialog based app.

Posted on 1998-09-22
3
262 Views
Last Modified: 2013-11-19
I want to implement something like the savemodified function
in a dialog based application (so no document available). Does anybody how to do this ?

Thanks in advance
0
Comment
Question by:dataman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 70 total points
ID: 1322412
This can only be done manually, you will need to check for any change in your dialog, wether it'd be EN_CHANGE from CEdit or anything else from your listboxes, combos, etc...

You can then flag a boolean member variable.

A "cute" alternative is to diable your OK button and leave the cancel button enabled. Then when a change is made enable the OK button, works much like the APPLY button in a property page.
0
 

Author Comment

by:dataman
ID: 1322413
I have still one question. What if I youse the Alt-F4 key to terminate the program.
How can I catch this.
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1322414
void CDialogDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
      if ((nID & 0xFFF0) == IDM_ABOUTBOX)
      {
            CAboutDlg dlgAbout;
            dlgAbout.DoModal();
      }
    else if( (nID & 0xFFF0) == SC_CLOSE ) {
        int i =15;
        // Do your stuff
    }
      else
      {
            CDialog::OnSysCommand(nID, lParam);
      }
}

OnSysCommand is automatically inserted in your dialog application to handle the about menu added to the system menu. In that same call you can trap SC_CLOSE and if you don't call the base class, like I've done here your dialog won't close.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

630 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