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 creates problem under unicode standard

CFileDialog creates problem under unicode standard

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
9 Posts 2 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.
  • M Offline
    M Offline
    m_mun
    wrote on last edited by
    #1

    Hi all, I am using '_UNICODE' rather '_MBCS' in my MFC single document app. My problem code- CString openFilePath; CFileDialog fileOpen(true, NULL, NULL, NULL, L"Text file(.txt)||*.txt", NULL); openFilePath = fileOpen.GetPathName(); //it returns CString 'GetPathName()' returns just a single charecter. When i use '_MBCS' it returns full file path. I want unicode standard with full file path when i open a file using "CFileDialog". Thanks

    D 1 Reply Last reply
    0
    • M m_mun

      Hi all, I am using '_UNICODE' rather '_MBCS' in my MFC single document app. My problem code- CString openFilePath; CFileDialog fileOpen(true, NULL, NULL, NULL, L"Text file(.txt)||*.txt", NULL); openFilePath = fileOpen.GetPathName(); //it returns CString 'GetPathName()' returns just a single charecter. When i use '_MBCS' it returns full file path. I want unicode standard with full file path when i open a file using "CFileDialog". Thanks

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

      Shaheen.India wrote:

      'GetPathName()' returns just a single charecter. When i use '_MBCS' it returns full file path.

      How are you verifying this?

      Shaheen.India wrote:

      I want unicode standard with full file path when i open a file using "CFileDialog".

      CFileDialog does not open files. It merely allows you to select them.

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      M 1 Reply Last reply
      0
      • D David Crow

        Shaheen.India wrote:

        'GetPathName()' returns just a single charecter. When i use '_MBCS' it returns full file path.

        How are you verifying this?

        Shaheen.India wrote:

        I want unicode standard with full file path when i open a file using "CFileDialog".

        CFileDialog does not open files. It merely allows you to select them.

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        M Offline
        M Offline
        m_mun
        wrote on last edited by
        #3

        Verifying in Debug mode. It sends a single character as a string. When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string

        D 1 Reply Last reply
        0
        • M m_mun

          Verifying in Debug mode. It sends a single character as a string. When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string

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

          Which does not answer my question. If you are using the Watch window, then you'll need to use the ,su symbol to see Unicode strings. Otherwise, you're just going to see a single character.

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          M 1 Reply Last reply
          0
          • D David Crow

            Which does not answer my question. If you are using the Watch window, then you'll need to use the ,su symbol to see Unicode strings. Otherwise, you're just going to see a single character.

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            M Offline
            M Offline
            m_mun
            wrote on last edited by
            #5

            Using object of CFileDialogIt sends a single character as a string. When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string. OK. How can i get open file path?

            modified on Wednesday, November 11, 2009 10:41 AM

            D 1 Reply Last reply
            0
            • M m_mun

              Using object of CFileDialogIt sends a single character as a string. When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string. OK. How can i get open file path?

              modified on Wednesday, November 11, 2009 10:41 AM

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

              Shaheen.India wrote:

              When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string

              This makes no sense. You've shown no code that opens a file, only code that selects a file. What's the "it" that you are referring to? You would receive more reliable help if you'd post the actual code that you are commenting on or asking a question about.

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              M 2 Replies Last reply
              0
              • D David Crow

                Shaheen.India wrote:

                When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string

                This makes no sense. You've shown no code that opens a file, only code that selects a file. What's the "it" that you are referring to? You would receive more reliable help if you'd post the actual code that you are commenting on or asking a question about.

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                M Offline
                M Offline
                m_mun
                wrote on last edited by
                #7

                OK. Can i get full file when i open a file using 'CFileDialog's constructor?

                1 Reply Last reply
                0
                • D David Crow

                  Shaheen.India wrote:

                  When i open a file, if it belongs like "e:\MyData\aa.txt", it returns just "e" as string

                  This makes no sense. You've shown no code that opens a file, only code that selects a file. What's the "it" that you are referring to? You would receive more reliable help if you'd post the actual code that you are commenting on or asking a question about.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  M Offline
                  M Offline
                  m_mun
                  wrote on last edited by
                  #8

                  This is my simple code: CString openFilePath; CFileDialog fileOpen(true, NULL, NULL, NULL, L"Text file(.txt)||*.txt", NULL); if(fileOpen.DoModal() == IDOK) { openFilePath = fileOpen.GetPathName();//Here is a break point. at this stage //value of openFilePath display like {"e"} only. .. .. }

                  D 1 Reply Last reply
                  0
                  • M m_mun

                    This is my simple code: CString openFilePath; CFileDialog fileOpen(true, NULL, NULL, NULL, L"Text file(.txt)||*.txt", NULL); if(fileOpen.DoModal() == IDOK) { openFilePath = fileOpen.GetPathName();//Here is a break point. at this stage //value of openFilePath display like {"e"} only. .. .. }

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

                    Shaheen.India wrote:

                    openFilePath = fileOpen.GetPathName();//Here is a break point. at this stage //value of openFilePath display like {"e"} only.

                    See here.

                    "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    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