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. CFileDialog does not open

CFileDialog does not open

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

    I use following code to open a CFileDialog: ... CFileDialog oFile(TRUE, "*.tab", m_strFile, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "MapInfo Layer (*.tab)|*.tab|Alle Files (*.*)|*.*||", this); if (oFile.DoModal()==IDCANCEL) { return; } ... If m_strFile is a string that points to a folder already exists (C:\) the File Dialog does not open. What is the reason?

    B B 2 Replies Last reply
    0
    • U User 1354

      I use following code to open a CFileDialog: ... CFileDialog oFile(TRUE, "*.tab", m_strFile, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "MapInfo Layer (*.tab)|*.tab|Alle Files (*.*)|*.*||", this); if (oFile.DoModal()==IDCANCEL) { return; } ... If m_strFile is a string that points to a folder already exists (C:\) the File Dialog does not open. What is the reason?

      B Offline
      B Offline
      Brigg Thorp
      wrote on last edited by
      #2

      It may have something to do with the fact that the variable m_strFile should be a filename, not a folder. I'm not exactly sure why it wouldn't come up, but that's my first clue.

      1 Reply Last reply
      0
      • U User 1354

        I use following code to open a CFileDialog: ... CFileDialog oFile(TRUE, "*.tab", m_strFile, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "MapInfo Layer (*.tab)|*.tab|Alle Files (*.*)|*.*||", this); if (oFile.DoModal()==IDCANCEL) { return; } ... If m_strFile is a string that points to a folder already exists (C:\) the File Dialog does not open. What is the reason?

        B Offline
        B Offline
        Blake Miller
        wrote on last edited by
        #3

        Also, the second parameter should probably not have the "*." part. I have always just used the extension letters, such as "TXT" or "DAT" or "TAB". I never use the "*." part of the extensions. Your extra extension text could be causing some sort of strange internal error.

        U 2 Replies Last reply
        0
        • B Blake Miller

          Also, the second parameter should probably not have the "*." part. I have always just used the extension letters, such as "TXT" or "DAT" or "TAB". I never use the "*." part of the extensions. Your extra extension text could be causing some sort of strange internal error.

          U Offline
          U Offline
          User 1354
          wrote on last edited by
          #4

          The problem seems to be the Filename I put in: m_strFile The FileDlg. want to put the c:\ into the file Filename... ...it notice that c:\is not a valid filename and returns. I can force the dlg with OFN_NOVALIDATE not to close itself. This is fine ... ...but where I can put in the Initial folder?

          1 Reply Last reply
          0
          • B Blake Miller

            Also, the second parameter should probably not have the "*." part. I have always just used the extension letters, such as "TXT" or "DAT" or "TAB". I never use the "*." part of the extensions. Your extra extension text could be causing some sort of strange internal error.

            U Offline
            U Offline
            User 1354
            wrote on last edited by
            #5

            I got it with: oFile.m_ofn.lpstrInitialDir=m_strFile; and set the 3rd parameter to NULL Thank you anyway

            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