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. Mobile Development
  3. Mobile
  4. UNICODE convention

UNICODE convention

Scheduled Pinned Locked Moved Mobile
c++helpquestion
5 Posts 2 Posters 5 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.
  • C Offline
    C Offline
    Cedric Moonen
    wrote on last edited by
    #1

    Hello, I'm using eVC++ 3.00 and I want to do such a thing: MessageBox("Test"); But I'll have an error at compilation: error C2664: 'MessageBoxW' : cannot convert parameter 1 from 'char [29]' to 'const unsigned short *' So, it's because UNICODE convention is used as standard. I suppressed it from the preprocessor settings but it still doesn't work! Is ANSI convention not supported ?? Thanks

    J 1 Reply Last reply
    0
    • C Cedric Moonen

      Hello, I'm using eVC++ 3.00 and I want to do such a thing: MessageBox("Test"); But I'll have an error at compilation: error C2664: 'MessageBoxW' : cannot convert parameter 1 from 'char [29]' to 'const unsigned short *' So, it's because UNICODE convention is used as standard. I suppressed it from the preprocessor settings but it still doesn't work! Is ANSI convention not supported ?? Thanks

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      Windows CE only supports UNICODE. All MFC methods and API functions and messages (with some notable exceptions) take UNICODE text. So, your code MUST read:

      MessageBox(_T("Test"));

      C 1 Reply Last reply
      0
      • J Joao Paulo Figueira

        Windows CE only supports UNICODE. All MFC methods and API functions and messages (with some notable exceptions) take UNICODE text. So, your code MUST read:

        MessageBox(_T("Test"));

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        That's it :-) !! This will give me a lot of work to convert my existing library :-( ! Is there a simple way to convert ANSI string to UNICODE string? char Buff[255]; ... ... // Do some stuff with Buff ... MessageBox(Buff); // Need conversion here !! Thanks

        J 1 Reply Last reply
        0
        • C Cedric Moonen

          That's it :-) !! This will give me a lot of work to convert my existing library :-( ! Is there a simple way to convert ANSI string to UNICODE string? char Buff[255]; ... ... // Do some stuff with Buff ... MessageBox(Buff); // Need conversion here !! Thanks

          J Offline
          J Offline
          Joao Paulo Figueira
          wrote on last edited by
          #4

          The best thing for you is start replacing char with TCHAR. If you want to do UNICODE to ANSI on-the-fly conversions, your application will run slower. But if you insist, use the mbstowcs, mbtowc, wcstombs and wctomb (check these out from the online help).

          C 1 Reply Last reply
          0
          • J Joao Paulo Figueira

            The best thing for you is start replacing char with TCHAR. If you want to do UNICODE to ANSI on-the-fly conversions, your application will run slower. But if you insist, use the mbstowcs, mbtowc, wcstombs and wctomb (check these out from the online help).

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            Ok, thanks a lot :-) ! I'll try to replace as more as possible char with TCHAR then ! Thanks

            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