-
Jun 5th, 2018, 01:53 PM
#1
Thread Starter
Fanatic Member
How to get unicode on KeyPress event?
Private Sub UserControl_KeyPress(KeyAscii As Integer)
I found that the parameter already is ANSI value, not UNICODE.
how to get the unicode character pressed to avoid to lose information in the convertion?.
Or what will happen if it is used on a chinese machine, etc. it will bring the real unicode value?
I tryed the "á" and that variable already has the ANSI value, not the 16bits unicode version of it.
-
Jun 5th, 2018, 02:16 PM
#2
Re: How to get unicode on KeyPress event?
You may need to subclass in order to intercept and translate WM_UNICHAR messages.
-
Jun 5th, 2018, 02:17 PM
#3
Thread Starter
Fanatic Member
Re: How to get unicode on KeyPress event?
Originally Posted by dilettante
You may need to subclass in order to intercept and translate WM_UNICHAR messages.
subclass what? the usercontrol container or the parent form?
-
Jun 5th, 2018, 02:21 PM
#4
Re: How to get unicode on KeyPress event?
Subclass the window you want to handle these characters for. If these are characters to the UserControl then subclass the UserControl.
-
Jun 5th, 2018, 02:23 PM
#5
Thread Starter
Fanatic Member
Re: How to get unicode on KeyPress event?
Wait, VB6 is capable in native controls to let the user write in japanese and so.? right?...
So, if doing a custom usercontrol, only to subclass the usercontrol, right?
-
Jun 5th, 2018, 07:18 PM
#6
Thread Starter
Fanatic Member
Re: How to get unicode on KeyPress event?
https://stackoverflow.com/questions/...si-window-uc-o
It will be lot harded than I though, the subclass won't work.
Because the VB6 forms are marked as ANSI, only ansi characters will reach the events.
Also don't know if usercontrol.print is able to print chinese/japanese, if the windows is marked as ANSI.
So, now that I have all my code in unicode.... found VB6 don't handle unicode interface. pffffffffffffffffffffffffffffff
-
Jun 6th, 2018, 08:33 AM
#7
Re: How to get unicode on KeyPress event?
Also notice that most of the information on VB6 on the interwebs is outdated.
Maybe others will chime in with links to proper threads here on VBForums the topic has been discussed, resolved, later fixed, rediscovered, etc.
cheers,
</wqw>
-
Jun 6th, 2018, 08:41 AM
#8
Thread Starter
Fanatic Member
Re: How to get unicode on KeyPress event?
Originally Posted by wqweto
Also notice that most of the information on VB6 on the interwebs is outdated.
Maybe others will chime in with links to proper threads here on VBForums the topic has been discussed, resolved, later fixed, rediscovered, etc.
cheers,
</wqw>
oh, you mean there is different about vb6 sp4 (those old threads) vs vb6 sp6?
-
Jun 6th, 2018, 09:58 AM
#9
Re: How to get unicode on KeyPress event?
but it is all about the keyboard, how can it be unicode? do we have unicode keyboards?
-
Jun 6th, 2018, 10:44 AM
#10
Re: How to get unicode on KeyPress event?
Why Baka, don't you do all your typing by holding down the alt key and using the keypad?
EDIT1: Or didn't you get one of these with the rest of us?
Last edited by Elroy; Jun 6th, 2018 at 10:49 AM.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Jun 6th, 2018, 01:39 PM
#11
Thread Starter
Fanatic Member
Re: How to get unicode on KeyPress event?
well, I consider, it is time to shift to another language's version, .NET.
I don't care about usercontrol's properybag because I don't even use it for storing text, it is loaded from a now unicode text file (skin scripting).
but, if the native textbox and others native controls is unable to edit, show, unicode characters, I don't want to change the class the about 600+ textboxes in 50+ forms, it will be a marathonic work.
And what more it requires?.
UNSOLVABLE PROBLEMS: and I don't get done the winsock overflow problem, the famous "this operation will block, in an async socket" problem, seem simply the ammount of traffic overflows the sockets internals, overall observed when just reset the server, and for when it is up again , there is 30+ clients PCs trying to connect... , the listening socket for connections is BLOWN . Ofcourse I did the code smarter enough, if the socket(0) gets an error/close event, the routine to set up it for listing again works. Works most of the times, but sometime it crashs ALL SOCKETs , ALL ARRAYs, at the same time, and then don't recover from that anymore, it is like, from 20 error , 1 is impossible to recover. Don't matther it close/unload the sockets, and then recreate it from scratchs, the sockets fails to listening, with the same error BLOCKING, on non blocking. And it already has the code to care about buffering the output, use the Send_Complete method, do it all in Byte arrays, everything fine...., small packages every time, not so small, like 4K is fine for LAN usage, etc.
Stadistically a customer receive a massive drop, each month. Seeing logs, it is about 1 massive drom each 10 to 20 times the socket error is logged.
It is also sensitive about what more is doing the server, if it is dedicated or shared server. So, the BLOCKING/ socket is timming sensitive.
Before with c-socketmaster was not that problem, but csocket has another issues with, data execute protection, and performance issues, it is not the faster thing.
Anyway, two reasons to abandon VB6. God I hate .Net, I resist the switch.
-
Jun 6th, 2018, 02:13 PM
#12
Re: How to get unicode on KeyPress event?
Originally Posted by flyguille
but, if the native textbox and others native controls is unable to edit, show, unicode characters, I don't want to change the class the about 600+ textboxes in 50+ forms, it will be a marathonic work.
And what more it requires?.
You could replace all intrinsic and common controls with the VBCCR controls. They are unicode at display and input (e.g KeyPress)
It come in two flavors: 1. As UserControls to include within an Std-EXE project. 2. As OCX.
http://www.vbforums.com/showthread.p...mmon-controls)
-
Jun 6th, 2018, 03:12 PM
#13
Re: How to get unicode on KeyPress event?
600+ textboxes in 50+ forms
You should be able to do this in just a few seconds.
Use NotePad++ to replace in all Form files "VB.TextBox" with "VBCCR15.TextBoxW" (without the quotes).
You will also need to add VBCCR15.Ocx to your Vbp file.
Last edited by DrUnicode; Jun 6th, 2018 at 03:21 PM.
Reason: Added Screenshot
-
Jun 6th, 2018, 03:17 PM
#14
Thread Starter
Fanatic Member
Re: How to get unicode on KeyPress event?
Originally Posted by DrUnicode
You should be able to do this in just a few seconds.
Use NotePad++ to replace in all Form files "VB.TextBox" with "VBCCR15.TextBoxW" (without the quotes).
You will also need to add VBCCR15.Ocx to your Vbp file.
Interesting, thanks very much SIR!.
-
Jun 7th, 2018, 02:38 AM
#15
Re: How to get unicode on KeyPress event?
Originally Posted by flyguille
https://stackoverflow.com/questions/...si-window-uc-o
It will be lot harded than I though, the subclass won't work.
Because the VB6 forms are marked as ANSI, only ansi characters will reach the events.
Also don't know if usercontrol.print is able to print chinese/japanese, if the windows is marked as ANSI.
So, now that I have all my code in unicode.... found VB6 don't handle unicode interface. pffffffffffffffffffffffffffffff
You should be able to mark the UserControl as Unicode with subclassing as well by responding to the WM_NOTIFYFORMAT message with NFR_UNICODE.
-
Jun 7th, 2018, 08:00 AM
#16
Re: How to get unicode on KeyPress event?
Right? Krool and DrUnicode already solved this issue in their controls.
You can look at the code, to see Krool did it, but it looks like he just caches the unicode char on WM_KEYDOWN/UP.
and then resets it in WM_CHAR.
-
Jun 9th, 2018, 06:55 AM
#17
PowerPoster
Re: How to get unicode on KeyPress event?
Well hey dudes, I have a better way of doing this. you just use the Fom_KeyPress() handler that comes within Forms and UserControls in VB6 and VBA objects. then here it goes...
Code:
Form_KeyPress(KeyAscii as blah blah)
Text1.Text = KeyAscii
End Sub
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|