I need help
-
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
-
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
-
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
- After you get the file name from the Dialog create the file using CFile or whatever. 2) In your (added) OnNewDocument function call SetPathName(""); e.g. BOOL CMyDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) SetPathName("c:\\temp\\a.txt"); // c:\temp\a.txt should exist! return TRUE; } This will not display a Save Dialog when you select "Save" from the File menu. If I have not misunderstood your question this should help! Due Regards Mahendra
-
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
the other responses are correct. my understanding of your statement is you are unable to access the file name from the My Doc class. one way to do this would be declare a variable in your CMyWinApp class and copy the value of the path into it now you can access this variable from your doc class by using. (CMyWinApp*)AfxGetApp()->variable
-
I have a program and in InitInstance i call a dialog in which i specify a file name for creating a new file and then i create this file calling CWinApp::FileNew.I need to know this file name in My doc class, more exactly in OnNewDocument.How can I do this? I desperately need help.F1!!!!!!!!My time is very short.
So you are naming the file before the app starts as opposed to when it (or the document) ends? Is there a design reason for this, or am I missing something? Normally in an SDI or MDI application, the name of the file is selected when the document is closing (i.e., if
IsModified()
returns non-zero).
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
So you are naming the file before the app starts as opposed to when it (or the document) ends? Is there a design reason for this, or am I missing something? Normally in an SDI or MDI application, the name of the file is selected when the document is closing (i.e., if
IsModified()
returns non-zero).
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
you should be available to get it through ((CYourMainAppClassNameHere*)AfxGetApp())->your_dialog_variable_name.string_variable, and you should update string variable on every change of file name hope it helps at least a little
-