|
-
August 13th, 1999, 06:19 AM
#1
path preselection for the dialog 'Save as'-dialog
In a SDI-application I want to determine the intitial path of the 'Save as'-dialog, which is called when I click on 'File-Save as'.
This should be possible with the OnSaveDocument-function.However, this function is only called when I click on 'File-Save' and the file's name is already determined.
What can I do?
Michael Flamensbeck
-
August 13th, 1999, 08:55 AM
#2
Re: path preselection for the dialog 'Save as'-dialog
Hi,
To Get the Path of the "Save As " Dlg , do the following
CFileDialog FileDlg(FALSE,..............)// Use other required parameters
FileDlg.DOModal();//Call the "Save As" Dlg
CString Path_Save_As = FileDlg.GetPathName(); //To get the PAth name
MessageBox(Path_Save_As);//To pop-up path name
I hope this info will help you.
For Further discussion,Pl mail me back.
With Smile,
Palani
-
August 13th, 1999, 01:42 PM
#3
Re: path preselection for the dialog 'Save as'-dialog
CString szTemp = "default.edl";
CFileDialog dlg(FALSE, _T("edl"), szTemp,
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
_T("SAWPLUS EDL Files (*.edl)|*.edl||"));
szTemp = "X:\\Starting\\Path\\";
dlg.m_ofn.lpstrInitialDir = (LPCTSTR)szTemp; // Set the start folder
if (dlg.DoModal() != IDOK)
{
return; // Cancel out.
}
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
-
August 13th, 1999, 01:57 PM
#4
Re: path preselection for the dialog 'Save as'-dialog
Possibly I misunderstood your question... what you need to do is derive your own class from CFileDialog and look at OnFolderChange() which will be called every time the folder is changed... By setting a BOOLean value to FALSE in the constructor, you can check for zero in OnFolderChange() and after it's been called once, set the BOOLean value to TRUE.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
-
August 19th, 1999, 08:11 AM
#5
Re: path preselection for the dialog 'Save as'-dialog
Hi,
thank's for answer, but it hits not my problem,
because the CFileDialog, which is called after I click the menu File-Save As... is not an object of my own code but part of the doc-view architecture.
M. Flamensbeck
-
August 19th, 1999, 01:55 PM
#6
Re: path preselection for the dialog 'Save as'-dialog
Well I don't think that my answer deserves a negative score point! If I'd given you a completely wrong answer I could understand that, but actually the answer I gave indicates what you have to do... You have to override the function in your Doc class where the Common Dialog is displayed [Add your own handler for OnFileSaveAs()] and derive your own class from CFileDialog where you handle the message OnFileNameOK(). That's the only way that you'll be able to get the value before the dialog is returned from DoModal().
You can see an example of subclassing CFileDialog on my web site at http://home.earthlink.net/~railro/mfc_link.html.
Rail
------------
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro/
[email protected]
-
August 20th, 1999, 05:11 AM
#7
Re: path preselection for the dialog 'Save as'-dialog
Sorry, I was really wrong with the negative score point. Your code with the additional line "CDocument::OnSaveDocument(dlg.GetPathName())"
in the OnFileSaveAs() handler of Doc class solves my problem. Thank you.
I would like change my rating in "Useful/Answer the question", but I don't know how!
M. Flamensbeck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|