From: Bob Butler on

"Boris Pauljev" <nordiccoder(a)hotmail.com> wrote in message
news:OMw5nZ45KHA.3880(a)TK2MSFTNGP04.phx.gbl...
> Thank you.
> I am having a serious problem...
>
> My code returns the wrong values for some reason, and I heavily under
> pressure....
>
> I have the following:
>
> dim iKeyCode%
> iKeyCode = 1609 'originally it comes from "iKeyCode = VkKeyScanW(vKey)"
>
> Now I need to find out if this iKeyCode contains
>
> Shift, Ctrl, Alt
>
> To do this, I use the following:
>
> iShift = (iKeyCode And &HFF00&) \ &H100&
> iVKKey = iKeyCode And &HFF&
>
> bShift = iShift And vbShiftMask 'vbShiftMask = 1
> bCtrl = iShift And vbCtrlMask 'vbCtrlMask = 2
> bAltGr = iShift And vbAltMask 'vbAltMask = 4

I think I'd define new constants identifying where the shift, ctrl, and alt
bit flags are in the result and then not bother with any bit shifting or
dealing with negative divisions or any of that mess.


From: Boris Pauljev on
And how? If you have any ideas, please write them down. Normally I don't
ask for help this way, but I am a total wreck.
From: Bob Butler on

"Boris Pauljev" <nordiccoder(a)hotmail.com> wrote in message
news:%23JIT4$65KHA.420(a)TK2MSFTNGP02.phx.gbl...
> And how? If you have any ideas, please write them down. Normally I don't
> ask for help this way, but I am a total wreck.

const vkshift=&H100
const vkctrl=&H200
const vkAlt=&H400

bShift = cbool(iShift And vkshift)
bCtrl = cbool(iShift And vkctrl)
bAltGr =cbool(iShift And vkAlt)


From: Jeff Johnson on
"Bob Butler" <noway(a)nospam.ever> wrote in message
news:OmYPjG75KHA.3292(a)TK2MSFTNGP06.phx.gbl...

> bAltGr =cbool(iShift And vkAlt)

Just to split hairs on your naming, you don't really know it's AltGr as
opposed to just Alt.


From: Boris Pauljev on
Bob, I am not sure yet, but I think your code works.... OMG, I would
really be up in the sky if this really works. I will test it on a client
computer now (who has not yet given up yet... luckily..)

Can you explain why vbAltMask is not what I want? I mean what is it good
for if one cannot use it anyway?
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6
Prev: GetAttr under Vista and Win 7
Next: Mystery 3 Surfaces Again