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. ATL / WTL / STL
  4. Avoiding MFC CString

Avoiding MFC CString

Scheduled Pinned Locked Moved ATL / WTL / STL
c++helpquestion
5 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.
  • H Offline
    H Offline
    hrishi321
    wrote on last edited by
    #1

    Hello all, I need to avoid MFC from my existing project, and convert to ATL. I am using STL for the most of the conversion (defining my own class for MFC type) CString has been use extensively in the project. So I guess its better to implement my own CString class. So that I dont need to touch all the implementation. I found out that ATL also has CString

    typedef CAtlString CString;

    So, if project setting avoids MFC, then CString will be refererd from this ATL CString class. But the problem is I need to touch and convert many code like

    "xx" to L"xx"
    char to wchar_t

    Can I have a efficient way, in order to avoid touching much implementation, and character code supportness. Shall I override this ATL CString class? or better right my own? considering about the supporting of character type (Unicode/others), could you Please suggest me, or advice me. thanks in advance Hrishi

    A D 2 Replies Last reply
    0
    • H hrishi321

      Hello all, I need to avoid MFC from my existing project, and convert to ATL. I am using STL for the most of the conversion (defining my own class for MFC type) CString has been use extensively in the project. So I guess its better to implement my own CString class. So that I dont need to touch all the implementation. I found out that ATL also has CString

      typedef CAtlString CString;

      So, if project setting avoids MFC, then CString will be refererd from this ATL CString class. But the problem is I need to touch and convert many code like

      "xx" to L"xx"
      char to wchar_t

      Can I have a efficient way, in order to avoid touching much implementation, and character code supportness. Shall I override this ATL CString class? or better right my own? considering about the supporting of character type (Unicode/others), could you Please suggest me, or advice me. thanks in advance Hrishi

      A Offline
      A Offline
      Albert Holguin
      wrote on last edited by
      #2

      The reason you're having those issues is that your original project probably had a setting of "Use Multi-Byte" characters or "ASCII" or something similar and now you seem to be attempting to use unicode. If you change you new project settings to use multi-byte characters or ASCII you won't have that problem but if you must use unicode, then you'll have to face the issue regardless. There may be some macros out there to help you out though, try searching google for them. Macros can be error prone however, so if its your intention to continue with unicode then you'll have to address the character and string definitions.

      V 1 Reply Last reply
      0
      • A Albert Holguin

        The reason you're having those issues is that your original project probably had a setting of "Use Multi-Byte" characters or "ASCII" or something similar and now you seem to be attempting to use unicode. If you change you new project settings to use multi-byte characters or ASCII you won't have that problem but if you must use unicode, then you'll have to face the issue regardless. There may be some macros out there to help you out though, try searching google for them. Macros can be error prone however, so if its your intention to continue with unicode then you'll have to address the character and string definitions.

        V Offline
        V Offline
        VeganFanatic
        wrote on last edited by
        #3

        I use CString all the time but not the ATL::Cstring It seems to be handy with MessageBox and other system calls so I use it all the time What is the issue with CString that is bothering you?

        http://www.contract-developer.tk

        A 1 Reply Last reply
        0
        • H hrishi321

          Hello all, I need to avoid MFC from my existing project, and convert to ATL. I am using STL for the most of the conversion (defining my own class for MFC type) CString has been use extensively in the project. So I guess its better to implement my own CString class. So that I dont need to touch all the implementation. I found out that ATL also has CString

          typedef CAtlString CString;

          So, if project setting avoids MFC, then CString will be refererd from this ATL CString class. But the problem is I need to touch and convert many code like

          "xx" to L"xx"
          char to wchar_t

          Can I have a efficient way, in order to avoid touching much implementation, and character code supportness. Shall I override this ATL CString class? or better right my own? considering about the supporting of character type (Unicode/others), could you Please suggest me, or advice me. thanks in advance Hrishi

          D Offline
          D Offline
          Derakhshan a
          wrote on last edited by
          #4

          use find and replace tool to replace ' "' to ' L"'.

          1 Reply Last reply
          0
          • V VeganFanatic

            I use CString all the time but not the ATL::Cstring It seems to be handy with MessageBox and other system calls so I use it all the time What is the issue with CString that is bothering you?

            http://www.contract-developer.tk

            A Offline
            A Offline
            Albert Holguin
            wrote on last edited by
            #5

            Why did you post that as a reply to me?

            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