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. CString to WCHAR

CString to WCHAR

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 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.
  • S Offline
    S Offline
    sschilachi
    wrote on last edited by
    #1

    how can you convert a CString to a WCHAR? Thanks

    P 1 Reply Last reply
    0
    • S sschilachi

      how can you convert a CString to a WCHAR? Thanks

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      First of all there is no real comparison between CString and WCHAR. If you are compiling under _UNICODE then CString already contains string in WCHAR format. so... (LPCTSTR)strTest; // will return you string in WCHAR under _UNICODE. If you have not declared _UNICODE then you may need to use WideByteToMultibyte api... lookup in the MSDN for further information.


      MSN Messenger. prakashnadar@msn.com "If history isn't good, just burn it." - Sidhuism.

      U 1 Reply Last reply
      0
      • P Prakash Nadar

        First of all there is no real comparison between CString and WCHAR. If you are compiling under _UNICODE then CString already contains string in WCHAR format. so... (LPCTSTR)strTest; // will return you string in WCHAR under _UNICODE. If you have not declared _UNICODE then you may need to use WideByteToMultibyte api... lookup in the MSDN for further information.


        MSN Messenger. prakashnadar@msn.com "If history isn't good, just burn it." - Sidhuism.

        U Offline
        U Offline
        usfesco
        wrote on last edited by
        #3

        Mr.Prakash wrote: If you have not declared _UNICODE then you may need to use WideByteToMultibyte api... lookup in the MSDN for further information should be MultiByteToWideChar..

        P 1 Reply Last reply
        0
        • U usfesco

          Mr.Prakash wrote: If you have not declared _UNICODE then you may need to use WideByteToMultibyte api... lookup in the MSDN for further information should be MultiByteToWideChar..

          P Offline
          P Offline
          Prakash Nadar
          wrote on last edited by
          #4

          :doh: thank you.


          MSN Messenger. prakashnadar@msn.com "If history isn't good, just burn it." - Sidhuism.

          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