[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

UNICODE

Posted on 2005-05-03
8
Medium Priority
?
390 Views
Last Modified: 2013-12-03
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 ?
0
Comment
Question by:hahahahahaha
  • 3
  • 3
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 13921362
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
 

Author Comment

by:hahahahahaha
ID: 13921584
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
 
LVL 86

Expert Comment

by:jkr
ID: 13921739
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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:hahahahahaha
ID: 13921914
It still shows ngu7o72i :( .
0
 

Author Comment

by:hahahahahaha
ID: 13922334
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
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 13923067
>> 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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question