Hi all.
Is there any way to tell if the 'Shift' key is held down when my app starts
?
I would like to have the app perform a different ( than usual ) operation if
the shift key is held down when the app starts, either from the exe or the
desktop shortcut.
TIA
Dave
Tim Baur - 31 Aug 2004 20:16 GMT
> Hi all.
>
[quoted text clipped - 8 lines]
>
> Dave
See Ken Halter's excellent example on testing the keyboard state at:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=%
237j1aA1PCHA.2696%40tkmsftngp13
Usage:
* * * * * * * *
Option Explicit
Private Declare Function _
GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Sub Form_Load()
Dim btArray(255) As Byte
Call GetKeyboardState(btArray(0))
If btArray(16) >= 127 Then
MsgBox "Shift Held"
End If
End Sub
alpine - 31 Aug 2004 20:23 GMT
>Hi all.
>
[quoted text clipped - 8 lines]
>
>Dave
You might want to have a look at the GetAsyncKeyState API function.
You can find more info in the MSDN and via a Google search.
HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
DaveO - 31 Aug 2004 20:30 GMT
My extreme thanks to all for their input and solutions.
Regards
Dave
---------------------------------------------------
Hi all.
Is there any way to tell if the 'Shift' key is held down when my app starts
?
I would like to have the app perform a different ( than usual ) operation if
the shift key is held down when the app starts, either from the exe or the
desktop shortcut.
TIA
Dave