Which document is being stored...
Alexander Pivovarov -- alx@ultersys.msk.su Thursday, February 22, 1996 Hi, I have redefined the method AddToRecentFileList(LPCTSTR lpszPathName). As I found out this method is called when a document is being stored. I would like to know which document is being store. Is there any way for doing this? Currently, I redefine DoSave method in the CDocument derived file and set the global variable... But I think this is not the best solution. Any ideas? Thanks in advance, Alexander ---------------------------- Alexander Pivovarov alx@ultersys.msk.su Ulter Systems, Inc.
Niels Ull Jacobsen -- nuj@kruger.dk Friday, February 23, 1996 [Mini-digest: 2 responses] > I have redefined the method AddToRecentFileList(LPCTSTR > lpszPathName). As I found out this method is called when a document > is being stored. I would like to know which document is being > store. Is there any way for doing this? Currently, I redefine > DoSave method in the CDocument derived file and set the global > variable... But I think this is not the best solution. Any ideas? As a quick "find-in-files" would have told you, AddToRecentFileList is called in one place (two places on a mac): CDocument::SetPathName() CDocument::OnOpenDocument() (macintosh version). As these are both virtual, override them two methods and call a custom MyAddToRecentFileList, which takes a CDocument pointer. STATIC_DOWNCAST(CMyApp,AfxGetApp())-> MyAddToRecentFileList(lpszPathName, this); -- Niels Ull Jacobsen, Kruger A/S Everything stated herein is THE OFFICIAL POLICY of the entire Kruger group and should be taken as legally binding in every respect. Pigs will grow wings and fly. -----From: "Robertson David"From your CWinApp-derived class, use: CDocument* pDoc = AfxGetMainWnd()->GetActiveDocument();
Mike Blaszczak -- mikeblas@msn.com Sunday, February 25, 1996 >From: "Robertson David"> > > From your CWinApp-derived class, use: > > CDocument* pDoc = AfxGetMainWnd()->GetActiveDocument(); The document being stored isn't always active... when you have many opened documents and you're "Saving All" or saving while exiting the application, for example. .B ekiM TCHAR sz[] = _T("Yeah, whatever.");
| Вернуться в корень Архива |