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. Can we have our application as _UNICODE supported as well _MBCS supported?

Can we have our application as _UNICODE supported as well _MBCS supported?

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • G Offline
    G Offline
    ganesa moorthy
    wrote on last edited by
    #1

    Hi, Can we have our application as _UNICODE supported as well _MBCS supported? I am in middle of a robust project, where we are using some third party sources. if i set my project to _UNICODE supported then it forces all the places where i am handling strings are to be wchar, TCHAR etc., can i make the same in some files, since it forces to make changes in third party sources. To make UNICODE Supported i made changes like "In Project settings in preprocessor definitions i just added _UNICODE. Also set startup with wWinMainCRTStartup. Qns: Can i support both of them ? if so How ? Thanks in advance. :rose:

    Thanks a lot

    M 1 Reply Last reply
    0
    • G ganesa moorthy

      Hi, Can we have our application as _UNICODE supported as well _MBCS supported? I am in middle of a robust project, where we are using some third party sources. if i set my project to _UNICODE supported then it forces all the places where i am handling strings are to be wchar, TCHAR etc., can i make the same in some files, since it forces to make changes in third party sources. To make UNICODE Supported i made changes like "In Project settings in preprocessor definitions i just added _UNICODE. Also set startup with wWinMainCRTStartup. Qns: Can i support both of them ? if so How ? Thanks in advance. :rose:

      Thanks a lot

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You are free to mix types all you want.  It's up to you to keep track of the settings and make sure you're using the right character types in the right places, and converting where necessary. I personally would go all unicode and use other character types only where required, but that's just me. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      L G 2 Replies Last reply
      0
      • M Mark Salsbery

        You are free to mix types all you want.  It's up to you to keep track of the settings and make sure you're using the right character types in the right places, and converting where necessary. I personally would go all unicode and use other character types only where required, but that's just me. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        Mark Salsbery wrote:

        It's up to you

        I'm betting that's the deal breaker part. ;)

        led mike

        1 Reply Last reply
        0
        • M Mark Salsbery

          You are free to mix types all you want.  It's up to you to keep track of the settings and make sure you're using the right character types in the right places, and converting where necessary. I personally would go all unicode and use other character types only where required, but that's just me. Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          G Offline
          G Offline
          ganesa moorthy
          wrote on last edited by
          #4

          No it is not possible if you set your project _UNICODE in project settings, it will override _MBCS. But i am here in position of converting a large project into UNICODE SUPPORTED. Can i build that third party tool into a DLL and link them with my project ? Even though that also be defined _UNICODE. Any Idea ? Get me out of this difficulty!. :(( Thanks :rose:

          Thanks a lot

          M 1 Reply Last reply
          0
          • G ganesa moorthy

            No it is not possible if you set your project _UNICODE in project settings, it will override _MBCS. But i am here in position of converting a large project into UNICODE SUPPORTED. Can i build that third party tool into a DLL and link them with my project ? Even though that also be defined _UNICODE. Any Idea ? Get me out of this difficulty!. :(( Thanks :rose:

            Thanks a lot

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            ganesa moorthy wrote:

            if you set your project _UNICODE in project settings, it will override _MBCS

            Of course, but you need to understand how that affects your compilation. Those are simply macros used with conditional compilation.  The macros effect the default char types in API function arguments and system structures.  They also affect the type of the tchar.h generic types like TCHAR. You are still free to use specific types where necessary. For the affected Windows APIs, you can call the specific APIs using the W and A suffixes where required.  Same with Windows SDK structures.  In places where you need a specific char type, do NOT use the generic TCHAR - use the right type. If you have third party code that requires a different character type then you need to deal with that by converting your strings/char arrays to the correct type where necessary.

            ganesa moorthy wrote:

            No it is not possible

            Not true :) Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            G 1 Reply Last reply
            0
            • M Mark Salsbery

              ganesa moorthy wrote:

              if you set your project _UNICODE in project settings, it will override _MBCS

              Of course, but you need to understand how that affects your compilation. Those are simply macros used with conditional compilation.  The macros effect the default char types in API function arguments and system structures.  They also affect the type of the tchar.h generic types like TCHAR. You are still free to use specific types where necessary. For the affected Windows APIs, you can call the specific APIs using the W and A suffixes where required.  Same with Windows SDK structures.  In places where you need a specific char type, do NOT use the generic TCHAR - use the right type. If you have third party code that requires a different character type then you need to deal with that by converting your strings/char arrays to the correct type where necessary.

              ganesa moorthy wrote:

              No it is not possible

              Not true :) Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              G Offline
              G Offline
              ganesa moorthy
              wrote on last edited by
              #6

              It is really an useful hint!, i hope i can use it n my project. Thanks :rose:

              Thanks a lot

              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