From: Boris Pauljev on 15 Mar 2010 01:39 I'm trying to test the keyboard input for the LLKHF_INJECTED flag. I got this from a forum: >>>> It means the flags member is a bitmasked value so you can extract usable information by hit-testing it against predefined masks: Private Const LLKHF_EXTENDED = &H1 Private Const LLKHF_INJECTED = &H10 Private Const LLKHF_ALTDOWN = &H20 Private Const LLKHF_UP = &H80 If struct.flags And LLKHF_EXTENDED Then 'An extended key If struct.flags And LLKHF_INJECTED Then 'An injected key <<<< This is generally clear to me, however I don't know if the author's "struct.flags And LLKHF_INJECTED" is really correct. When I insert a key by pressing down the key manually on the keyboard, struct.flags is 0. When I insert a key with e. g. the Microsoft on-screen keyboard, struct.flags is 16. So if I tested it as the author above did, LLKHF_INJECTED would never be true. Am I wrong? Boris
From: Henning on 15 Mar 2010 07:29 "Boris Pauljev" <nordiccoder(a)hotmail.com> skrev i meddelandet news:u9LYaIAxKHA.6140(a)TK2MSFTNGP05.phx.gbl... > I'm trying to test the keyboard input for the LLKHF_INJECTED flag. > > I got this from a forum: > >>>> > It means the flags member is a bitmasked value so you can extract usable > information by hit-testing it against predefined masks: > > Private Const LLKHF_EXTENDED = &H1 > Private Const LLKHF_INJECTED = &H10 > Private Const LLKHF_ALTDOWN = &H20 > Private Const LLKHF_UP = &H80 > > If struct.flags And LLKHF_EXTENDED Then 'An extended key > If struct.flags And LLKHF_INJECTED Then 'An injected key > <<<< > > This is generally clear to me, however I don't know if the author's > "struct.flags And LLKHF_INJECTED" is really correct. > > When I insert a key by pressing down the key manually on the keyboard, > struct.flags is 0. > When I insert a key with e. g. the Microsoft on-screen keyboard, > struct.flags is 16. > > So if I tested it as the author above did, LLKHF_INJECTED would never be > true. > > Am I wrong? > > Boris Yes, &H10 = 16 decimal. You have to AND with the const and check for a nonzero result. /Henning
From: Henning on 16 Mar 2010 07:56 "Henning" <computer_hero(a)coldmail.com> skrev i meddelandet news:ey78ELDxKHA.732(a)TK2MSFTNGP06.phx.gbl... > > "Boris Pauljev" <nordiccoder(a)hotmail.com> skrev i meddelandet > news:u9LYaIAxKHA.6140(a)TK2MSFTNGP05.phx.gbl... >> I'm trying to test the keyboard input for the LLKHF_INJECTED flag. >> >> I got this from a forum: >> >>>> >> It means the flags member is a bitmasked value so you can extract usable >> information by hit-testing it against predefined masks: >> >> Private Const LLKHF_EXTENDED = &H1 >> Private Const LLKHF_INJECTED = &H10 >> Private Const LLKHF_ALTDOWN = &H20 >> Private Const LLKHF_UP = &H80 >> >> If struct.flags And LLKHF_EXTENDED Then 'An extended key >> If struct.flags And LLKHF_INJECTED Then 'An injected key >> <<<< >> >> This is generally clear to me, however I don't know if the author's >> "struct.flags And LLKHF_INJECTED" is really correct. >> >> When I insert a key by pressing down the key manually on the keyboard, >> struct.flags is 0. >> When I insert a key with e. g. the Microsoft on-screen keyboard, >> struct.flags is 16. >> >> So if I tested it as the author above did, LLKHF_INJECTED would never be >> true. >> >> Am I wrong? >> >> Boris > > Yes, &H10 = 16 decimal. You have to AND with the const and check for a > nonzero result. > > /Henning > > You can test using: If (struct.flags And LLKHF_INJECTED) > 0 Then 'An injected key /Henning
From: Nobody on 16 Mar 2010 08:03 "Henning" <computer_hero(a)coldmail.com> wrote in message news:edXiI$PxKHA.3564(a)TK2MSFTNGP05.phx.gbl... > You can test using: > If (struct.flags And LLKHF_INJECTED) > 0 Then 'An injected key > > /Henning It's preferable to use "<> 0" or "= 0". If the flag was &H80000000, which is a negative number, the result would be negative in the above statement.
From: Henning on 16 Mar 2010 08:49 "Nobody" <nobody(a)nobody.com> skrev i meddelandet news:O35gNDQxKHA.1548(a)TK2MSFTNGP02.phx.gbl... > "Henning" <computer_hero(a)coldmail.com> wrote in message > news:edXiI$PxKHA.3564(a)TK2MSFTNGP05.phx.gbl... >> You can test using: >> If (struct.flags And LLKHF_INJECTED) > 0 Then 'An injected key >> >> /Henning > > It's preferable to use "<> 0" or "= 0". If the flag was &H80000000, which > is a negative number, the result would be negative in the above statement. > > In general thats correct, I was not concidering values other than presented. /Henning
|
Next
|
Last
Pages: 1 2 3 Prev: Spritley Old Guy Next: Microsoft Excel Object Library missing from IDE |