Thread: Chinese in .rc

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    37

    Question Chinese in .rc

    Hi,

    How do you write chinese in windows (in the .rc) using Win32 APIs? Also, how do you allow users to type in chinese in EDITTEXT and also how to store it? If it somehow matters, I'm developing using Dev-C++.

    Thanks in advance.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Unicode, but you and they have to have the Chinese simplified and/or Chinese traditional language pack installed.

    http://www.microsoft.com/downloads/d...displaylang=en
    Last edited by abachler; 08-10-2009 at 05:30 AM.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    37
    How do I use unicode? And does that mean if I can read chinese on my computer then it'll be fine, or do you mean some other packages?

    Thanks.

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    If you can read it on your computer, then you already have the language pack installed. Just type the Chinese into the resource file as normal. I'm not sure GCC has an actual RC application, I think it just uses a simple text editor which of course may not work with Unicode.

    Refer to these articles on MSDN which explains it better than I can.

    Using Unicode Data
    http://msdn.microsoft.com/en-us/library/cc194800.aspx
    http://msdn.microsoft.com/en-us/library/cc194801.aspx
    http://msdn.microsoft.com/en-us/library/cc194795.aspx
    http://msdn.microsoft.com/en-us/library/cc194799.aspx
    Last edited by abachler; 08-10-2009 at 06:01 AM.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    37
    But do I have to type in any commands before using unicode, like if I want to put something like this:

    Code:
    LTEXT "Some Chinese here", ID, 1, 1, 1, 1
    in my dialog, how do I do it? I tried just writing chinese there and compile it, but it just shows 2 characters like in the IDE.

  6. #6
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    You also have to use the Unicode versions of functions.

    Code:
    MessageBox(NULL , TEXT("Some Chinese Here.") , TEXT("Some More Chinese Here.") , MB_OK);
    May or may not display correctly, depending on your project settings.

    Code:
    MessageBoxA(NULL , TEXT("Some Chinese Here.") , TEXT("Some More Chinese Here.") , MB_OK);
    Will definitely NOT display properly, as you are using Unicode in an ANSII function call

    Code:
    MessageBoxW(NULL , TEXT("Some Chinese Here.") , TEXT("Some More Chinese Here.") , MB_OK);
    Will properly display the Chinese
    Last edited by abachler; 08-10-2009 at 06:09 AM.

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    37
    What about dialogs declared in .rc? Something like LTEXTW?

    Thanks.

  8. #8

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. .rc files in VC8
    By jsrig88 in forum Windows Programming
    Replies: 6
    Last Post: 05-10-2008, 06:01 PM
  2. .rc files not supported by VC++2005Express
    By bejiz in forum Windows Programming
    Replies: 2
    Last Post: 06-04-2006, 08:41 AM
  3. Making a DLL which includes an .rc file
    By Halloko in forum Windows Programming
    Replies: 2
    Last Post: 07-27-2005, 07:53 AM
  4. Chinese and C++
    By Swaine777 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2003, 03:01 PM
  5. Chinese characters
    By madmandan in forum Windows Programming
    Replies: 3
    Last Post: 07-10-2002, 06:19 AM