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. Problem in CFileOpenDialog

Problem in CFileOpenDialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasehelp
9 Posts 6 Posters 1 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
    Murugan k
    wrote on last edited by
    #1

    Hi, I have done report genaration project in vc++. I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed. But that file placed on any other drives like(c:,d:,..), nothing to worry, it will execute successfully...

    N T J D 4 Replies Last reply
    0
    • M Murugan k

      Hi, I have done report genaration project in vc++. I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed. But that file placed on any other drives like(c:,d:,..), nothing to worry, it will execute successfully...

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      Can you show me the code? Is the buffer to which you recieve the file path, long enough to hold a maximum of 255 characters?

      nave

      1 Reply Last reply
      0
      • M Murugan k

        Hi, I have done report genaration project in vc++. I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed. But that file placed on any other drives like(c:,d:,..), nothing to worry, it will execute successfully...

        T Offline
        T Offline
        Try
        wrote on last edited by
        #3

        Even the Desktop [folder] is in C drive. C:\Documents and Settings\User\Desktop There may be some other problem.

        1 Reply Last reply
        0
        • M Murugan k

          Hi, I have done report genaration project in vc++. I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed. But that file placed on any other drives like(c:,d:,..), nothing to worry, it will execute successfully...

          J Offline
          J Offline
          JudyL_MD
          wrote on last edited by
          #4

          Are you correctly handling the spaces in the file name? Judy

          L 1 Reply Last reply
          0
          • J JudyL_MD

            Are you correctly handling the spaces in the file name? Judy

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hello Judy, what is the right way to handle the spaces in the file name and file path? regards termal

            J 1 Reply Last reply
            0
            • L Lost User

              Hello Judy, what is the right way to handle the spaces in the file name and file path? regards termal

              J Offline
              J Offline
              JudyL_MD
              wrote on last edited by
              #6

              Without seeing your code, I can't tell. It all depends on what you do with the name after you get it. Some of the APIs that take a file name (no, I don't remember which ones off the top of my head, and there isn't a list I'm aware of) need to have "" around a name that has spaces in it. Run with the debugger and see where it crashes. Judy

              D 1 Reply Last reply
              0
              • J JudyL_MD

                Without seeing your code, I can't tell. It all depends on what you do with the name after you get it. Some of the APIs that take a file name (no, I don't remember which ones off the top of my head, and there isn't a list I'm aware of) need to have "" around a name that has spaces in it. Run with the debugger and see where it crashes. Judy

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

                JudyL_FL wrote:

                Some of the APIs that take a file name...

                But what do those have to do with CFileDialog?


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                J 1 Reply Last reply
                0
                • M Murugan k

                  Hi, I have done report genaration project in vc++. I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed. But that file placed on any other drives like(c:,d:,..), nothing to worry, it will execute successfully...

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

                  Without seeing how you are using CFileDialog, help is going to be hard to come by. Have you tried using GetOpenFileName() to see if the problem is specific to MFC? What is the value of _WIN32_WINNT?


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  1 Reply Last reply
                  0
                  • D David Crow

                    JudyL_FL wrote:

                    Some of the APIs that take a file name...

                    But what do those have to do with CFileDialog?


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    J Offline
                    J Offline
                    JudyL_MD
                    wrote on last edited by
                    #9

                    Nothing. I missed that the probelm was in that function and not after he calls it in the original post. OP: Have you tried using the debugger? The CFileDialog class does handle the desktop correctly - I've used it to do that and it's fine. Using the debugger will pinpoint where the problem is. You've probably made some mistake in the setup prior to calling the function, and seeing where in the class the crash occurs will provice lots of clues about where the problem is. You need to post some code and use the debugger. Judy

                    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