Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Have a problem with CFileDialog [modified]

Have a problem with CFileDialog [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    m1m2
    wrote on last edited by
    #1

    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

    R M D 3 Replies Last reply
    0
    • M m1m2

      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

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • M m1m2

        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

        M Offline
        M Offline
        m1m2
        wrote on last edited by
        #3

        Find it :) when i browse for a file it change curren directory and save file in another plase :)

        1 Reply Last reply
        0
        • M m1m2

          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

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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 a CArchive 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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups