Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Unicode keyboard input
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Unicode keyboard input

 Post Reply Post Reply
Author
Message
dbenito View Drop Down
Groupie
Groupie


Joined: 14 May 2008
Location: Spain
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbenito Quote  Post ReplyReply Direct Link To This Post Topic: Unicode keyboard input
    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?
Back to Top
dbenito View Drop Down
Groupie
Groupie


Joined: 14 May 2008
Location: Spain
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbenito Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2010 at 6:49am
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.
Back to Top
surfer_del View Drop Down
Newbie
Newbie
Avatar

Joined: 12 August 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote surfer_del Quote  Post ReplyReply Direct Link To This Post Posted: 26 August 2011 at 7:45am
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
Back to Top
TomasS View Drop Down
Groupie
Groupie
Avatar

Joined: 28 January 2009
Location: Sweden
Status: Offline
Points: 47
Post Options Post Options   Thanks (0) Thanks(0)   Quote TomasS Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2012 at 9:08am
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
Back to Top
ngyntom View Drop Down
Newbie
Newbie


Joined: 14 February 2012
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote ngyntom Quote  Post ReplyReply Direct Link To This Post Posted: 14 February 2012 at 3:42am
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
Back to Top
surfer_del View Drop Down
Newbie
Newbie
Avatar

Joined: 12 August 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote surfer_del Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2012 at 12:29am
Smile
hi i request you to send the code please. but didnt replied .
if you have that please provide the community.
 
thank you,
 
surfer
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.