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. How can I call CFileDialog in "xxxxDoc.cpp" in SDI application

How can I call CFileDialog in "xxxxDoc.cpp" in SDI application

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
6 Posts 4 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.
  • P Offline
    P Offline
    phanindra varma
    wrote on last edited by
    #1

    hi... How can i call "CFileDialog" in "testDoc.cpp" which is not inherited from CWnd Class. i tried the following /****************************/ BOOL Test() { CFileDialog dlg(FALSE,............,NULL); return TRUE; } /***************************/ but it was not working!!!!!and showing error when function returns!!! Is there any need to delete the object. How can i approach?????

    _ S D 3 Replies Last reply
    0
    • P phanindra varma

      hi... How can i call "CFileDialog" in "testDoc.cpp" which is not inherited from CWnd Class. i tried the following /****************************/ BOOL Test() { CFileDialog dlg(FALSE,............,NULL); return TRUE; } /***************************/ but it was not working!!!!!and showing error when function returns!!! Is there any need to delete the object. How can i approach?????

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      BOOL Test() { CFileDialog dlg(FALSE,............,NULL); dlg.DoModal(); // :doh: return TRUE; }

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      P 1 Reply Last reply
      0
      • P phanindra varma

        hi... How can i call "CFileDialog" in "testDoc.cpp" which is not inherited from CWnd Class. i tried the following /****************************/ BOOL Test() { CFileDialog dlg(FALSE,............,NULL); return TRUE; } /***************************/ but it was not working!!!!!and showing error when function returns!!! Is there any need to delete the object. How can i approach?????

        S Offline
        S Offline
        sudhir_Kumar
        wrote on last edited by
        #3

        What error it shows,When returns.

        Sudhir Kumar

        P 1 Reply Last reply
        0
        • S sudhir_Kumar

          What error it shows,When returns.

          Sudhir Kumar

          P Offline
          P Offline
          phanindra varma
          wrote on last edited by
          #4

          hi... " Un Handled error Exception arises...."

          1 Reply Last reply
          0
          • _ _AnsHUMAN_

            BOOL Test() { CFileDialog dlg(FALSE,............,NULL); dlg.DoModal(); // :doh: return TRUE; }

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            P Offline
            P Offline
            phanindra varma
            wrote on last edited by
            #5

            I have done that and i did some extra stuff when i click Save and when i click cancel. but after that when the function return s then it arises EXCEPTION error. Thanku....

            1 Reply Last reply
            0
            • P phanindra varma

              hi... How can i call "CFileDialog" in "testDoc.cpp" which is not inherited from CWnd Class. i tried the following /****************************/ BOOL Test() { CFileDialog dlg(FALSE,............,NULL); return TRUE; } /***************************/ but it was not working!!!!!and showing error when function returns!!! Is there any need to delete the object. How can i approach?????

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

              This is actually a known bug that comes about due to the size of the OPENFILENAME structure being used with MFC. You need to define _WIN32_WINNT to be 0x500, and set the lStructSize member to to 88 (instead of 76). You might also need to use GetOpenFileName() instead of CFileDialog().

              "Love people and use things, not love things and use people." - Unknown

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

              modified on Wednesday, June 4, 2008 8:45 AM

              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