Unicode keyboard input |
Post Reply |
Author | |
dbenito
Groupie Joined: 14 May 2008 Location: Spain Status: Offline Points: 30 |
Post Options
Thanks(0)
Posted: 31 August 2010 at 1:25pm |
I'm struggling with a rather obscure problem: when hosted on VB6 forms, COM controls that host Unicode windows (e.g. created by calling CreateWindowExW) receive incorrect information in WM_CHAR messages for certain Unicode characters (for example, if you try to enter Tamil characters you always get sent question marks instead); funnily enough, if the same control is hosted in a Unicode application (such as IE), the WM_CHAR messages come through just fine. I suspect it has something to do with VB6 calling the ANSI version of TranslateMessage in the message loop.
Any, I finally figured out a way of getting around this, which is to subclass the Unicode window, storing the keycode sent in WM_KEYDOWN and then constructing the corresponding Unicode character in WM_CHAR message (by calling ToUnicodeEx in certain circumstances, etc.), and it works fine in my own controls.
Unfortunately, the CodeJock Suite Controls don't do any such handling, and it would be a pain to have to subclass each one individually (particularly since they already use subclasses internally, and I'd rather not interfere with that). So I though a solution might be to install a thread-wide WH_GETMESSAGE hook and do the same kind of processing. The weird this is that, when I check the data sent with the WM_CHAR message intercepted by my hook, the Unicode characters are always set correctly. However, whether I return from the hook immediately or I call the next hook, the control (in this case a CodeJock FlatEdit control, which internally uses a standard Windows Edit control) eventually seems to receive a WM_CHAR with the wrong stuff (character code 63, as usual).
Does anyone have any experience with entering complex script text (particularly for the new Unicode-only locales that were added in Windows XP, such as Tamil or Gujarati?) into CodeJock Suite controls hosted in VB6?
|
|
dbenito
Groupie Joined: 14 May 2008 Location: Spain Status: Offline Points: 30 |
Post Options
Thanks(0)
|
I realize most people probably won't be interested in this, but I'll post my solution just in case:
What I ended up doing was a combination of hooking and subclassing (using the ComCtl32 subclassing functions, which are only supported on Windows XP or greater, but are very safe and don't seem to interfere with existing subclasses). First I install a WH_CALLWNDPROC hook (for the thread in which my VB6 UI is running) to intercept all WM_CREATE events, and I basically subclass any new window that gets created (making sure to remove the subclass when WM_DESTROY gets called). I also install a WH_GETMESSAGE hook (again, only for my UI thread), and whenever it gets a WM_CHAR message, it stores the hWnd and wParam values (which always seem to include the correct Unicode char). Then, in the subclass window proc, when I process a WM_CHAR message I compare the hWnd values and, if they match, I replace the incorrect wParam (which VB6 has probably messed up somehow) and replace it with the value I had stored.
If anybody is having trouble with complex script input with CodeJock controls in VB6, I'll be glad to send them code snippets.
|
|
surfer_del
Newbie Joined: 12 August 2011 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
thanx for your suggestion i am facing the same problem. whenever i try to input with ime (google or other) i get ?????. i am using vb6 with sp6. please send the code to amaanshiekh@yahoo.com
i hope you will reply with best wishes amaan |
|
surfer
|
|
TomasS
Groupie Joined: 28 January 2009 Location: Sweden Status: Offline Points: 47 |
Post Options
Thanks(0)
|
I had similar problems in vb6. I tried entering unicode text in chinese, korean and some other languages, but they all just turned into question marks in the CJ controls. Just like in the native controls. But after setting keypreview=false on the form it worked fine.
|
|
Xtreme SuitePro (ActiveX) version 17.3.0, 16.3.1
Windows 10 64-bit Visual Basic 6.0 |
|
ngyntom
Newbie Joined: 14 February 2012 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
I tried entering unicode text in vietnam, flatedit display ??. i changed keypreview but not show, can u help me?
i'm using -Codejock.Controls.Unicode.v15.0.1.ocx -vb6sp6
|
|
surfer_del
Newbie Joined: 12 August 2011 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
hi i request you to send the code please. but didnt replied .
if you have that please provide the community. thank you, |
|
surfer
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |