Solved

Override the Save

Posted on 1998-06-24
2
308 Views
Last Modified: 2013-11-20
Using MFC,  I am trying to override the OnSave Function.  Yet, If I click Save As it still goes to the System Controlled Dialog Box, before going to my function.   This also happens if I save for the first time. How do I get around this?  There doesn't seem to be an OnSaveAs Function to override, at least not in ClassWizard.  

Thanks!!  
0
Comment
Question by:smithc
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1318374
You user chooses File Save command WM_COMMAND message with ID_FILE_SAVE is sent to main application window and is handled by cDocument class OnFileSave function. you can override this behaviour by declaring your own message handler in your document class.
Add to your document class message map
ON_COMMAND(ID_FILE_SAVE, OnFileSave)
add afx_msg void OnFileSave() to your document class declaration
and add OnFileSave() function implementation
0
 

Author Comment

by:smithc
ID: 1318375
Perfect.   I wonder why I couldn't find the option to override OnFileSave in ClassWizard??

Thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 100
fizzArray2 challenge 1 79
canBalance challenge 34 85
Capture logon name 13 73
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 …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 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