Unicode Programming in MFC
   Unicode characters are invented to accommodate additional international characters apart from English. Earlier characters were represented in ASCII formats with each character occupying 1 byte of memory. But with Unicode, each character is represented with 2 bytes.

   There is one more type of character set using 2 bytes i.e.MBCS (Multi Byte Character Set) or DBCS (Double Byte Character Set). In fact any article about MFC Unicode programming, will have a reference to the MBCS and DBCS. This character set is used for single locale specific programming i.e., it can support only one locale set in an application. But using Unicode will enable the programs to use multiple locale character sets simultaneously.

   As the benefits of Unicode programming looks immense as described above, it is imperative for any application to give support to Unicode. MFC supports Unicode in a very flexible way by providing a single line macro to convert between a Unicode and non-Unicode application.

MFC Unicode Macro:

    The macro,

           #define _UNICODE  

    will make the application Unicode enabled. But a mere use of the macro will not be enough to make an application Unicode enabled. Some of the important things the application should take care of are listed below.

  • The entry point of the application should be set as wWinMainCRTStartup
  • Strings should be declared and used as TCHAR type.
  • The Length of the string should be passed as Length * sizeof(TCHAR)
  • Use string functions declared in TCHAR.H viz., _tcscat, __tcscpy, _tcscmp etc.,

   Using the TCHAR programming set will enable the compiler to choose between Unicode C Runtime library and non-Unicode library. If the program is defined to be a UNICODE program, it will expand the TCHAR routines to ASCII functions. If the program does not have any UNICODE macro defined, it will be built as an ASCII application.

MFC Unicode - Points to be Noted:  

  1. Using Unicode makes Windows NT/2000 efficient as Unicode is the standard character set used in processing characters. Any non-Unicode literals will be converted back and forth for manipulations.
  2. Win 98 platforms do not support Unicode.

Close    To Top
  • Prev Article-Programming:
  • Next Article-Programming:
  • Now: Tutorial for Web and Software Design > Programming > c > Programming Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction