Click here to Skip to main content
15,891,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have successfully overrode the ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) function in an SDI app, but no chance with ON_COMMAND(ID_FILE_SAVE, CWinApp::OnFileSave), The base one is always called ! :(
Any ideas !

Help me please.
Posted

1 solution

See:

http://msdn.microsoft.com/en-us/library/11861byt(v=vs.80).aspx[^]

OnFileSave is not a member of CWinApp. See:

http://msdn.microsoft.com/en-us/library/kayts37a(v=vs.80).aspx[^]

OnFileSave is a member of CDocument.

The problem you are having is that the ID_FILE_SAVE message is routed to the open CDocument first -- which handles the message. The message never gets routed to the app so your ID_FILE_SAVE message handling at the app level never gets invoked.

(You might want to read up on message routing in Win32 / MFC, start with: http://msdn.microsoft.com/en-us/library/xt2c310k(v=vs.80).aspx[^])
 
Share this answer
 
Comments
Mr. Tomay 26-Jun-11 11:18am    
It seems clear now ;)
Albert Holguin 13-Jul-11 21:41pm    
Its hard to override a member that's not a member... ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900