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. MDI File Open

MDI File Open

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 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.
  • A Offline
    A Offline
    Aint
    wrote on last edited by
    #1

    Hi. Where should I put the codes for reading binary files if I have created a MDI application with CFormView? Do I need to use the serialize function?

    N D 2 Replies Last reply
    0
    • A Aint

      Hi. Where should I put the codes for reading binary files if I have created a MDI application with CFormView? Do I need to use the serialize function?

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      ReturnRain wrote:

      Do I need to use the serialize function?

      Yes. That's what document view architecture is all about?


      Nibu thomas A Developer Programming tips[^]  My site[^]

      A 1 Reply Last reply
      0
      • N Nibu babu thomas

        ReturnRain wrote:

        Do I need to use the serialize function?

        Yes. That's what document view architecture is all about?


        Nibu thomas A Developer Programming tips[^]  My site[^]

        A Offline
        A Offline
        Aint
        wrote on last edited by
        #3

        okay.. so I use this? if(ar.IsStoring()) ... else ... where do I put this then? if (m_ldFile.DoModal() == IDOK) { // Get the pathname selected m_filePath = m_ldFile.GetPathName(); ... I just don't get on how to use the serialize function to open file. And how do I have this data to the view part?

        N 1 Reply Last reply
        0
        • A Aint

          okay.. so I use this? if(ar.IsStoring()) ... else ... where do I put this then? if (m_ldFile.DoModal() == IDOK) { // Get the pathname selected m_filePath = m_ldFile.GetPathName(); ... I just don't get on how to use the serialize function to open file. And how do I have this data to the view part?

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          ReturnRain wrote:

          okay.. so I use this? if(ar.IsStoring()) ... else ...

          You misunderstood Serialize function. Serialize function is the place where you do the writing to a file to make your document data persistent. if( ar.IsStoring() ) // Write here code for saving your data else // Write here code for loading data You don't have to worry about opening and closing the file it's done for you by Doc/View architecture. CArchive contains a valid open file. So you need to just use the overloaded << and >> operators. Well if you have a byte array you have to use CArchive::Write. Since you said you have an MDI application, you should have File, Edit and other menus.


          Nibu thomas A Developer Programming tips[^]  My site[^]

          A 1 Reply Last reply
          0
          • N Nibu babu thomas

            ReturnRain wrote:

            okay.. so I use this? if(ar.IsStoring()) ... else ...

            You misunderstood Serialize function. Serialize function is the place where you do the writing to a file to make your document data persistent. if( ar.IsStoring() ) // Write here code for saving your data else // Write here code for loading data You don't have to worry about opening and closing the file it's done for you by Doc/View architecture. CArchive contains a valid open file. So you need to just use the overloaded << and >> operators. Well if you have a byte array you have to use CArchive::Write. Since you said you have an MDI application, you should have File, Edit and other menus.


            Nibu thomas A Developer Programming tips[^]  My site[^]

            A Offline
            A Offline
            Aint
            wrote on last edited by
            #5

            okay.. thanks! and since MDI have a different class for doc and view, how do I get the data from doc to view? i want to store the data in an array that I have declared in view.

            N 1 Reply Last reply
            0
            • A Aint

              okay.. thanks! and since MDI have a different class for doc and view, how do I get the data from doc to view? i want to store the data in an array that I have declared in view.

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #6

              ReturnRain wrote:

              and since MDI have a different class for doc and view, how do I get the data from doc to view? i

              Call CYourDocument::UpdateAllViews. From MSDN: Call this function after the document has been modified. You should call this function after you call the SetModifiedFlag member function. This function informs each view attached to the document, except for the view specified by pSender, that the document has been modified. You typically call this function from your view class after the user has changed the document through a view.


              Nibu thomas A Developer Programming tips[^]  My site[^]

              1 Reply Last reply
              0
              • A Aint

                Hi. Where should I put the codes for reading binary files if I have created a MDI application with CFormView? Do I need to use the serialize function?

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

                ReturnRain wrote:

                Do I need to use the serialize function?

                You can, but it's certainly not a requirement. The document holds the data, regardless of how it is acquired. The view renders said data.


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                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