Results 1 to 4 of 4

Thread: Key depressed on execute

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    *.*
    Posts
    85

    Key depressed on execute

    Is it possible to pick up if a user is holding down a key as they double click a created .exe file? I was wondering if I could set my application to go into a 'configure mode' if started by with a double click when say shift held down.

    cheers

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    i think so...(not sure how exactly but...)

    maybe in the Sub Main() capture the keyboard and check which key is being held...then start the appropriate form.
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    VB Code:
    1. Private Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
    2. Sub Main()
    3.     Do
    4.         For i = 3 To 255
    5.             If GetAsyncKeyState(i) Then
    6.                 If i = vbKeyShift then 'may need the value of shift
    7.                     form2.show
    8.                     Exit Sub
    9.                     End If
    10.             End If
    11.         Next
    12.         DoEvents
    13.     Loop
    14. End Sub

    That could be completely wrong...(like vbKeyShift)
    but hey..give it a shot...cant test here at work
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    *.*
    Posts
    85
    ta geoff_xrx I will try that when I get home


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width