Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / August 2004



Tip: Looking for answers? Try searching our database.

Start App with key pressed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DaveO - 31 Aug 2004 19:57 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.