Article View: borland.public.cppbuilder.nativeapi
Article #2035Unicode hell....
From: Mike Collins
Date: Fri, 11 May 2007 19:55
Date: Fri, 11 May 2007 19:55
61 lines
3693 bytes
3693 bytes
Hi all, must have posted about this problem 5 times now... Each time i get
a bit closer to a solution but i'm still very confused.
I have a need to identify a MS / Windows generated dialog box in order to
send it a message. I'm enumerating all desktop windows to find it. I
cannot identify it by it's class id so i must identify it by it's caption.
This is fine for English versions of Windows as i know the caption that i'm
;looking for. On other language versions, i must store the different
captions in a resource and then provide some sort of look up based on the
system locale. I have coded this all and it all works, i have slowly
compiled a list of all the alternative language version of the caption i am
looking for. However, i run into a problem when i hit non-Latin based
systems i.e. Unicode.
On these systems, i can get the caption but obviously, it is in a Unicode
format and i need to convert this, and my code, so i can deal with it. If i
use a resource editor, i can not see the Unicode values - they are just
displayed are ??????. My understanding from what has been written here, i
need to convert the Unicode characters into there respective escape
characters and then store the escape sequence in my resource file, preceding
it with an L to indicate it is a wide / Unicode string i.e.
STRINGTABLE
{
1, "ASCII caption"
2, L"\x0421\x043f\x0440\x0430\x0432\x043a\x0430"
}
however, i don't seem to be able to do anything with this... I can read it
in using the LoadStringW api but i just get the escape value in my wchar_t
array. Even if i try to display them using MessageBoxW i still just get
garbage displayed.
wchar_t w[1000];
int i = LoadStringW(HInstance, 2, w, 1000);
MessageBoxW(NULL, w, L"test", MB_OK);
Displays -> 213f4030323a30
I'm obviously missing something critical here.
1) is there any simple way to convert to the escape character sequence
without hunting through the Character Map utility.
2) am i storing the escape characters correctly in my resource file?
3) am i reading the resource string correctly?
4) is there some sort of conversion that i need to apply before i can use or
compare the Unicode string that i have read in.
5) finally, everything that i read states that the VCL does not support
Unicode. In following with this, all the string properties of the vcl's are
AnisStrings. However, a Russian developer that i know can develop
application in C++Builder that use and display Russian characters within his
applications. I have seen screen shots of his applications and you can
clearly see the Russian characters in the caption of the form. How is this
possible if the vcl does not support Unicode.
Sorry for the essay, i really hope someone can give me the final pointers
that i need
Many, many thanks in advance,
Mike
Technical Details
Message-ID:
<4644ba20@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1b8e94d3011c4bc5,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mike Collins" <its@TheBottomOfThePost> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Unicode hell.... Date: Fri, 11 May 2007 19:55:54 -0000 Lines: 63 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.3959 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3959 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 89.240.136.226 Message-ID: <4644ba20@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1178909216 89.240.136.226 (11 May 2007 11:46:56 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail