Solved

SaveModified in dialog based app.

Posted on 1998-09-22
3
249 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Turn a spreadsheet into a vba executable. 2 92
Tab names are off by one 5 54
How to determine file rename from EventLog ? 2 54
only14 challenge 19 81
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

789 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