UNICODE

Hi,
I have a program named "A" supporting typing in my language . For example , If I type "a" then type "1" , it will become "á" .

a1  ---> á
a2  ---> à
a3  ---> ả
a4  ---> ã
a5  ---> ạ
o6  ---> ô
...

And I have a program in which I have a string = "a1" . Then I use

for (count=0; count<string.GetLength(); count++)
::PostMessage(hFocus, WM_KEYDOWN, VkKeyScan(string.GetAt(count)), 0);

The above program named A was already opened. But it just shows "a1" , not "á" . I want it shows "á" , not "a1" . How can I do ?
hahahahahahaAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
>> It still shows ngu7o72i

Yes. That's the same UNICODE representation. Unless you place e.g. Japanese characters in the source, you won't see a difference.
0
 
jkrCommented:
As is http:Q_21408834.html

Try

for (count=0; count<temp.GetLength(); count++)
::PostMessageW(hFocus, WM_KEYDOWN, VkKeyScanW(temp.GetAt(count)), 0);

to enforce using the UNICODE version of the Win32 APIs. However, you'll have to ensure that 'temp' holds UNICODE data. E.g. ike in

wchar_t wc = 0xa1;

::PostMessageW(hFocus, WM_KEYDOWN, VkKeyScanW(wc), 0);
0
 
hahahahahahaAuthor Commented:
Would you like to give me a program that can run ? I did like you but it didn't show anything . Ok , if I have a string = "ngu7o72i" , I want it will become "ng&#432;&#7901;i" when it shows on screen . I say again , I have string "ngu7o2i" , like this
CString string = "ngu7o72i";

for (count=0; count<string.GetLength(); count++)
::PostMessageW(hFocus, WM_KEYDOWN, VkKeyScanW(string.GetAt(count)), 0);

It's still incorrect :(


0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
jkrCommented:
Yes, the above is being fed with ANSI data. You need to use UNICODE:

CString string = "ngu7o72i";
wchar_t* pwsz = new wchar_t[string.GetLength() + 1];
mbstowcs( pwsz, string, string.GetLength() + 1);

for (count=0; count<string.GetLength(); count++)
::PostMessageW(hFocus, WM_KEYDOWN, VkKeyScanW(pwsz[count]), 0);

delete [] pwsz;

0
 
hahahahahahaAuthor Commented:
It still shows ngu7o72i :( .
0
 
hahahahahahaAuthor Commented:
I cant understand what the difference between I type myself and I use "::PostMessage(hFocus, WM_KEYDOWN, VkKeyScan(string.GetAt(count)), 0); " .

I think it is the same action . But the result is different :( .Plz help me , I'm hurry .
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.