Solved

SaveModified in dialog based app.

Posted on 1998-09-22
3
252 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Title # Comments Views Activity
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 911
Complete beginner needs help making a cron job 9 129
zeroMAx challenge 20 125
Capture logon name 13 100
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

735 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