Thread: Arabic unicode problem with "MessageBoxW"

  1. #1
    Registered User
    Join Date
    Jun 2022

    Arabic unicode problem with "MessageBoxW"

    I'm learning API programming and used "MessageBoxW" to show Arabic unicode characters but this small program failed to show the Arabic characters correctly and rather of that it shows characters have no sense:

    #include <windows.h>
    #include <tchar.h>
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
         MessageBoxW (NULL, _TEXT (L"بسم الله الرحمن الرحيم"), _TEXT (L"HelloMsg"), 0) ;
         return 0 ;

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well saying _TEXT and L together is redundant.
    The _TEXT macro automatically puts an L in the result when in UNICODE mode.


    I also had to save the source file as a UNICODE text file.

    I tried the code with those changes.
    The text seems right, but the default font is rather small.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2022
    Maybe I've out-of-date tools. thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A "Simple" Array/String Problem. "Help" ASAP needed
    By AirulFmy in forum C Programming
    Replies: 10
    Last Post: 08-19-2015, 04:30 AM
  2. Replies: 2
    Last Post: 12-08-2014, 08:12 PM
  3. Replies: 4
    Last Post: 07-17-2012, 09:02 AM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM

Tags for this Thread