Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The author in of this article

CDocument::DoSave revealed

claimed to have overriden dosave, but on checking documentation at

http://msdn.microsoft.com/en-us/library/sd83ta1b.aspx



I could find none of OnFileSave, OnFileSaveas and DoSave as a member function.Pls I don't know what to make of this.Kindly help me out.
Posted
Updated 19-Feb-14 7:04am
v2
Comments
Sergey Alexandrovich Kryukov 19-Feb-14 14:03pm    
Why not asking the author of the article?
—SA

As you are referring one Article, then please add a comment at the bottom.
The author will get notified and reply you back.
 
Share this answer
 
Comments
Gbenbam 19-Feb-14 13:04pm    
The last time I did, I have not gotten any response till now.I don't intend to attempt such again.If you can offer other form of assistance please do.
If you look at the afxwin.h file, the CDocument class implementation does have those calls. Not sure why MS doesn't document them but they're there.

DoSave is under a section labeled as:
C++
// implementation helpers


and the other two are under:
C++
// file menu commands
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Feb-14 14:12pm    
Where? I did not find functions with those exact names, too. And this is not the root of the problem. Please see my answer.
—SA
Albert Holguin 19-Feb-14 15:18pm    
I looked within the afxwin header that's part of the VS2008. The article was written around 2002 I believe, so if they're not in the new CDocument, it may be they were removed, but they were also not referenced in the 2008 documentation even though I can see they're there.
Sergey Alexandrovich Kryukov 19-Feb-14 15:59pm    
Not sure. I looked at VS 2013 documentation, and then 2005, same thing.
Having OnFileSave, OnFileSaveas would simply be illogical. OnSaveDocument is the part of "Save" and "Save As", and documentation confirms it...
—SA
Albert Holguin 19-Feb-14 16:32pm    
Like I said, it's not in the documentation, but it is in the code.... and when exactly has logic ever stopped MS from doing something? lol
Sergey Alexandrovich Kryukov 19-Feb-14 16:44pm    
MS is not completely illogical. There are weak fields. MFC is a legacy which last since pretty bad times of Microsoft (in terms of quality), so...
—SA
There is no OnSave, but there is OnSaveDocument:
http://msdn.microsoft.com/en-us/library/sd83ta1b.aspx[^].

And why would you possibly need help on overriding? If a function is virtual (and the function mentioned above is virtual), I hope you know how to override it. If it is not, you cannot override it at all? How such stuff may possibly need any help with?

On the other detail, the author of the article is responsible, no matter if can reach this person or not. I have a question for you: are you going to start writing code by yourself instead of reading code offered by others and playing with it? Or you already do? Then focus on it. Playing with other people's code is not the most productive way of doing things or learning.

—SA
 
Share this answer
 
v3
Comments
Albert Holguin 19-Feb-14 15:20pm    
True, overriding is trivial.
Gbenbam 20-Feb-14 5:57am    
Please see my last comment.
Gbenbam 20-Feb-14 5:49am    
I have in the past had difficulty locating documentation o. functions is msdn.Quite recently I found out whenever I use the namd of the function in a google search, I always get a link to the desired documentation.When it came to doing a google search with they functions i
under discussion, I did not get any link to any page of ms documentation but I got many reference to the function.In one of the search result, someone was trying to understand why his override of CApp::OnFileSave and CApp::OnFileSaveas did not work.He was told those functions are not members of CApp.In another search result,someone else wanted to know why his override of CDocument::OnFileSave wasn't working.A member of microsoft told him that both onfilesaveas and onfilesav call DoFileSave, if OnFileSave realises the file has not been saved previously, it calls DoFileSave.So I kind of fidure that overriding these function was somehow tricky.Since I learnt MFC years back, this is mg first mfc and first doc/view app.I feel that in order to make meaningful overrride of the functions under duscussion I needed to understand the default implemetation of the functions.IF wanted to read them up for myself and not base my override on some article or forum discussion.The help I came here seeking was that on locating the documentation on those functions so that I could read them up and proceed to write an effective overrride.I just couldn't understand why I couldn't locate documentation on those functions when so much mention ( as far as google search is concerned).I do believe those function existed.I have given up my search for them and decided to override OnSaveDocument which I have already done.

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