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 ?
Printable View
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 ?
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.
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
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?
Quote:
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.