Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SaveModified in dialog based app.

Posted on 1998-09-22
3
Medium Priority
?
285 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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 280 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Integration Management Part 2
Suggested Courses

886 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