|
-
Aug 21st, 2001, 05:11 AM
#1
Thread Starter
New Member
knowing what key is pressed when the app is starting
I would like to start an app in visible mode or invisible mode depending on a key pressed on the keyboard when it starts.
Does anybody know how to do ?
-
Aug 21st, 2001, 06:22 AM
#2
Hmmm. Intresting question. Off the top of my head, I'd say start your app wtih a Splash screen. Put some code in the Form KeyPress event, and show or don't show the start up form depending on what key was captured in this event.
Hope this helps.
-
Aug 21st, 2001, 02:02 PM
#3
Use the GetAsyncKeyState API function to detect key presses.
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyA) Then Msgbox "A key was pressed": Exit Sub
End Sub
-
Aug 22nd, 2001, 06:35 AM
#4
For Matthew Gates: Given renaud's question, where would you put your Timer? On the main app form? A startup form which loads, but does not show?
-
Aug 22nd, 2001, 07:26 AM
#5
Originally posted by Hack
For Matthew Gates: Given renaud's question, where would you put your Timer? On the main app form? A startup form which loads, but does not show?
If you wish, you can have the form hidden. You could also use a class or even a module, I assume, along with the SetTimer and KillTimer API functions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|