Solved

SaveModified in dialog based app.

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 …
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now