From: Boris Pauljev on 29 Apr 2010 13:21 Can you please specify what you think? Did you say that you think that the 1609 seems to be wrong? I was not able to understand what you wanted to say by > Looks like it. > Just the 3 shift keys (and no normal key) would be 1792 (00000111-00000000) >
From: Helmut Meukel on 29 Apr 2010 13:58 "Boris Pauljev" <nordiccoder(a)hotmail.com> schrieb im Newsbeitrag news:OgONWC85KHA.4940(a)TK2MSFTNGP05.phx.gbl... > Thanks, but when I have > > vKey = 105 > iKeyCode = 1605 > > it still tells me that Alt and Ctrl are pressed. > Boris, which key(s) did you really press? The AltGr key is only on european keyboards and it creates the codes of Ctrl + Alt. You can easily test this, to get the characters @, {, }, [, ], or the Euro sign on most european keybords you usually press AltGr together with the appropriate key. But you'll get those characters by pressing Ctrl + Alt, too. HTH. Helmut.
From: Bob Butler on 29 Apr 2010 14:27 "Boris Pauljev" <nordiccoder(a)hotmail.com> wrote in message news:OgONWC85KHA.4940(a)TK2MSFTNGP05.phx.gbl... > Thanks, but when I have > > vKey = 105 > iKeyCode = 1605 > > it still tells me that Alt and Ctrl are pressed. > > iKeyCode comes from > > iKeyCode = VkKeyScanW(vKey) assuming the 1605 is the decimal value then in hex that would be 645 The '45' is the key which is 69 decimal or "E" The '6' is the set of bit flags where shift=1 ctrl=2 alt=4 so it is showing ctrl+alt which apparently also means AltGr from what Helmut posted const vkAltGR=&H600 if (iKeyCode And vkAltGr)=vkAltGr Then ' altgr or alt+ctrl
From: Boris Pauljev on 29 Apr 2010 14:47 In a Turkish Windows, I ran the code, and for "i" (it's the same on the Turkish keyboard as the ASCII "i", among other Turkish which also correspond to ASCII characters), it returned 1605. It's driving me crazy. I wanted to say that "a" also exists on a Turkish keyboard and an English keyboard, and in my tests, they were the same. They produced normal results, not AltGr indicators. All keys are perfectly fine and what I would have awaited, only "i" is giving this strange value, indicating that AltGr should be pressed, which is definitively wrong. Any ideas what might cause this behaviour?
From: Henning on 29 Apr 2010 19:56
"Boris Pauljev" <nordiccoder(a)hotmail.com> skrev i meddelandet news:OTQlWV65KHA.4116(a)TK2MSFTNGP02.phx.gbl... > Thank you. In my case, iKeyCode will never be negative, so I would rule > the signed division problem. > > I did the following: > > Dim lAscW& > lAscW = AscW("i") 'In fact it's not an "i" but a Turkish character that > looks similar. > > I really wanted to say "1609". This number is being returned from > VkKeyScanExW when I do the following: > > Dim lKeyboard& > lKeyboard = GetKeyboardLayout(0) > > Dim lAscW& > lAscW = AscW(sChar) > > iKeyCode = VkKeyScanExW(vKey, lKeyboard) > > I do know for sure that this character is not a shifted character, not an > Alt character and not a Ctrl character, and it exists on this keyboard. > > Do you have any more ideas what might go wrong? > > I was so sure that I made a mistake in the bit calculation part... > I could swear that there is not even any key that can be produced by > hitting ALT+Ctrl+Shift... so this CANNOT be correct in my opinion. I guess this has to do with VB KeyCodes are only valid for a US keyboard + some more. All international keys can't fit into the "extended" 256 char ASCII. You may just have to accept that the Turkish Unicode "i" is represented as Ctrl-Alt i. I guess other "special" Turkish keys will produce the same "errors". You for example have 4 different "i"'s. A look-up table can solve the issue. /Henning |