What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Get ascii character from virtual key code

Pages: (2): « First « 1 [ 2 ] Last »
Get ascii character from virtual key code
Author: Message:
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
O.P. RE: RE: RE: RE: Get ascii character from virtual key code
quote:
Originally posted by CookieRevised
quote:
Originally posted by deAd
I think I have fixed the problem by comparing the key code with the result of VkKeyScanW and the character's ASCII code :)
No...

And since you speak of "the character's ASCII code", it means that this special key of yours might just be a shortcut of another standard existing key. So, use that one instead.

quote:
Originally posted by deAd
EDIT: and it's not a very uncommon key.... I'm fairly certain almost all keyboards have it, as it's used within plus! as well :P
tbh, very very doubtfull.

-------

What is the key and what is it supposed todo in Plus!?

The key is VK_OEM_4 (0xDB) on US keyboards, which is ASCII 91 (0x5B), or "[". It may not be parsed when it is typed as in the script, but it is used for tags within plus!, and many other projects, so it must be common to be on keyboards.

Why would using VkKeyScanW not work? I provide it with a static ASCII code which never changes (91, or 0x5B) and it provides me with its virtual key code (in my case, VK_OEM_4 or 0xDB). It's then compared to the pressed key code so it should work on all systems that have "[" as one of the keys...

I do not think it's a "shortcut" for another existing key, because MSDN labels only VK_OEM_4 as "[", and the ChatWndEditKeyDown function provides a virtual key code and not an ASCII one...

This post was edited on 01-15-2007 at 10:49 PM by deAd.
01-15-2007 10:48 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Get ascii character from virtual key code
quote:
Originally posted by Matty
It is doable using ToAcii, GetKeyboardState, GetKeyboardLayout.

It actually isn't. Also ToAscii also requires a scan code, which isn't provided by Plus!.

quote:
Originally posted by deAd
It may not be parsed when it is typed as in the script, but it is used for tags within plus!, and many other projects, so it must be common to be on keyboards.
It is not because the character [ is used as part of formatting tags, that Plus! detects it as a virtual key. Plus! parses the string you already typed and checks the ascii codes (which can be different than virtual codes). As I know you know... :p

quote:
Originally posted by deAd
The key "[" is VK_OEM_4 (0xDB)
That character/key can be 0xDD on other keyboards for example, also you must to take into account the shift states which Plus! doesn't all support either, so:

quote:
Originally posted by deAd
It's then compared to the pressed key code so it should work on all systems that have "[" as one of the keys...
It wont unfortunatly, because it is an OEM key.

Ps: And on Belgium keyboard pressing "[" will not even trigger a ChatWndEditKeyDown as it involves pressing AltGr (=right ALT) which is not detected by Plus! either.

Not to mention that the API VkKeyScan is something left over from Win95 and since then much things have changed (while the API has not). It wont work ligatures, dead keys, SGCAPS, or anything on the numeric keypad. And the biggest problem is it does not distinguish between the left and the right SHIFT/CTRL/ALT keys, which would be needed to specifically define the proper key. The API VkKeyScan is virtually (get it? 'virtually' :D:p) useless and shouldn't be used....

This post was edited on 01-18-2007 at 03:18 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
01-17-2007 09:00 AM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
O.P. RE: Get ascii character from virtual key code
Well then...I guess what I'm trying to do won't work. :P
01-17-2007 11:13 PM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On