Have a problem with CFileDialog [modified]
-
Hi. I write one application i have one button(browse) when click on it, it call CFileDialog.DoModal(). When user chose a file, the dialog thake the name and call to save it to another file void CRgnDoc::MyFileSaveFunction(int i,CString filename) { m_iStart=i; //int m_strSongPath=filename; //CString - separate string and save like //integer OnSaveDocument("OneClock.one"); } my Serialize function look like this void CRgnDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // storing code int i; i=m_strSongPath.GetLength(); ar<>i; for (int j=0;j>ch; m_strSongPath=m_strSongPath+(char)ch; // TRACE("%c",ch); // AfxMessageBox("asw"); } ar>>m_iStart; } } when call MyFileSaveFunction(), Serizlize() don't want to save my file byt if i call MyFileSaveFunction(4,"test") withought call CFileDalog befor that it work correct and everithing is save Meto -- modified at 7:19 Tuesday 29th August, 2006
-
Hi. I write one application i have one button(browse) when click on it, it call CFileDialog.DoModal(). When user chose a file, the dialog thake the name and call to save it to another file void CRgnDoc::MyFileSaveFunction(int i,CString filename) { m_iStart=i; //int m_strSongPath=filename; //CString - separate string and save like //integer OnSaveDocument("OneClock.one"); } my Serialize function look like this void CRgnDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // storing code int i; i=m_strSongPath.GetLength(); ar<>i; for (int j=0;j>ch; m_strSongPath=m_strSongPath+(char)ch; // TRACE("%c",ch); // AfxMessageBox("asw"); } ar>>m_iStart; } } when call MyFileSaveFunction(), Serizlize() don't want to save my file byt if i call MyFileSaveFunction(4,"test") withought call CFileDalog befor that it work correct and everithing is save Meto -- modified at 7:19 Tuesday 29th August, 2006
m1m2 wrote:
Serizlize() don't want to save my file
What do you mean ? What goes wrong ? Have you gone through debugging ?
m1m2 wrote:
OnSaveDocument("OneClock.one");
OT: I am not used to writing MDI/SDI Apps, so this is maybe wrong, but calling an event handler function seems weird to me.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
-
Hi. I write one application i have one button(browse) when click on it, it call CFileDialog.DoModal(). When user chose a file, the dialog thake the name and call to save it to another file void CRgnDoc::MyFileSaveFunction(int i,CString filename) { m_iStart=i; //int m_strSongPath=filename; //CString - separate string and save like //integer OnSaveDocument("OneClock.one"); } my Serialize function look like this void CRgnDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // storing code int i; i=m_strSongPath.GetLength(); ar<>i; for (int j=0;j>ch; m_strSongPath=m_strSongPath+(char)ch; // TRACE("%c",ch); // AfxMessageBox("asw"); } ar>>m_iStart; } } when call MyFileSaveFunction(), Serizlize() don't want to save my file byt if i call MyFileSaveFunction(4,"test") withought call CFileDalog befor that it work correct and everithing is save Meto -- modified at 7:19 Tuesday 29th August, 2006
-
Hi. I write one application i have one button(browse) when click on it, it call CFileDialog.DoModal(). When user chose a file, the dialog thake the name and call to save it to another file void CRgnDoc::MyFileSaveFunction(int i,CString filename) { m_iStart=i; //int m_strSongPath=filename; //CString - separate string and save like //integer OnSaveDocument("OneClock.one"); } my Serialize function look like this void CRgnDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // storing code int i; i=m_strSongPath.GetLength(); ar<>i; for (int j=0;j>ch; m_strSongPath=m_strSongPath+(char)ch; // TRACE("%c",ch); // AfxMessageBox("asw"); } ar>>m_iStart; } } when call MyFileSaveFunction(), Serizlize() don't want to save my file byt if i call MyFileSaveFunction(4,"test") withought call CFileDalog befor that it work correct and everithing is save Meto -- modified at 7:19 Tuesday 29th August, 2006
m1m2 wrote:
i have one button(browse) when click on it, it call CFileDialog.DoModal(). When user chose a file, the dialog thake the name and call to save it to another file
Why? When the document saves its data, you will be presented with a Save As dialog where you can select the file to save to. It sounds as though you are reinventing the wheel.
m1m2 wrote:
OnSaveDocument("OneClock.one");
This function is called by the framework as part of the File Save or File Save As command. It is not called directly.
m1m2 wrote:
MyFileSaveFunction(), Serizlize() don't want to save my file
The
Serialize()
method is used simply to get the data to/from the document from aCArchive
object. It has no knowledge of files or where the data comes from. That's the document's job.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb