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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CFileDialog

CFileDialog

Scheduled Pinned Locked Moved C / C++ / MFC
announcement
8 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.
  • K Offline
    K Offline
    KKR
    wrote on last edited by
    #1

    MyApplication is disappearing when I try to use CFileDialog to get a file name to save contents. This is not happening in case of Dubug version. And OS is win2000. Any suggesstions. Warm Regards, KKR

    B 1 Reply Last reply
    0
    • K KKR

      MyApplication is disappearing when I try to use CFileDialog to get a file name to save contents. This is not happening in case of Dubug version. And OS is win2000. Any suggesstions. Warm Regards, KKR

      B Offline
      B Offline
      BadJerry
      wrote on last edited by
      #2

      Never seen this... how do you actually call CFileDialog? maybe your filter is not defined correctly... and that would explain why you have a different behaviour in debug and release...

      K 1 Reply Last reply
      0
      • B BadJerry

        Never seen this... how do you actually call CFileDialog? maybe your filter is not defined correctly... and that would explain why you have a different behaviour in debug and release...

        K Offline
        K Offline
        KKR
        wrote on last edited by
        #3

        Thanks for the Respose, Following is the code static char BASED_CODE szFilter[] = "INI Files (*.INI)|*.INI|All Files (*.*)|*.*||"; CString m_szCurrentFilePath; CFileDialog obFDlg( FALSE, ".INI", m_szCurrentFilePath, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter, pApp ); obFDlg.DoModal(); Warm Regards, KKR

        B F B 3 Replies Last reply
        0
        • K KKR

          Thanks for the Respose, Following is the code static char BASED_CODE szFilter[] = "INI Files (*.INI)|*.INI|All Files (*.*)|*.*||"; CString m_szCurrentFilePath; CFileDialog obFDlg( FALSE, ".INI", m_szCurrentFilePath, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter, pApp ); obFDlg.DoModal(); Warm Regards, KKR

          B Offline
          B Offline
          BadJerry
          wrote on last edited by
          #4

          OK a few things... pApp is not a window... you should have AfxGetMainWnd() and as for the extension I think your are meant to have "INI" not ".INI" and I take your app does not use Unicode. Let me know if does the trick!

          K 1 Reply Last reply
          0
          • B BadJerry

            OK a few things... pApp is not a window... you should have AfxGetMainWnd() and as for the extension I think your are meant to have "INI" not ".INI" and I take your app does not use Unicode. Let me know if does the trick!

            K Offline
            K Offline
            KKR
            wrote on last edited by
            #5

            Yeah, In trial and error , I've kept pApp, but it holds only Parent window, Reg Extn what ever it is ".ini" or "ini", its disappearing. My application is not UNICODE one. Warm Regards, KKR

            B 1 Reply Last reply
            0
            • K KKR

              Yeah, In trial and error , I've kept pApp, but it holds only Parent window, Reg Extn what ever it is ".ini" or "ini", its disappearing. My application is not UNICODE one. Warm Regards, KKR

              B Offline
              B Offline
              BadJerry
              wrote on last edited by
              #6

              Well this is spooky and it is something I use all the time. Is your office built on an ancient indian cemetry or something? One more stab in the dark, have you tried to initialise your m_szCurrentFilePath (to _T("")) or pass NULL instead? Let me know if you do find out!

              1 Reply Last reply
              0
              • K KKR

                Thanks for the Respose, Following is the code static char BASED_CODE szFilter[] = "INI Files (*.INI)|*.INI|All Files (*.*)|*.*||"; CString m_szCurrentFilePath; CFileDialog obFDlg( FALSE, ".INI", m_szCurrentFilePath, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter, pApp ); obFDlg.DoModal(); Warm Regards, KKR

                F Offline
                F Offline
                FearlessBurner
                wrote on last edited by
                #7

                I have experience similar (but not identical) problems with CFileDialog based code when the file path string is incorrect. In such cases, the usual result is that the dialog fails to appear. My advice is therefore to verify that the lpszFileName parameter (3rd one) is correct. You could also try using an empty string instead, and see whether that produces different results. Hope this helps.

                1 Reply Last reply
                0
                • K KKR

                  Thanks for the Respose, Following is the code static char BASED_CODE szFilter[] = "INI Files (*.INI)|*.INI|All Files (*.*)|*.*||"; CString m_szCurrentFilePath; CFileDialog obFDlg( FALSE, ".INI", m_szCurrentFilePath, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter, pApp ); obFDlg.DoModal(); Warm Regards, KKR

                  B Offline
                  B Offline
                  Bo Hunter
                  wrote on last edited by
                  #8

                  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxstructures/openfilename.asp

                  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