How would you make a private sub form_keydown, without having to have the form in focus?
What i want is for if you have my program open, but are currently focused on program, and hit "enter" then lblmessage = "yo" lets say.
Printable View
How would you make a private sub form_keydown, without having to have the form in focus?
What i want is for if you have my program open, but are currently focused on program, and hit "enter" then lblmessage = "yo" lets say.
Use the GetAsyncKeyState API function.
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" _ (ByVal vKey As Long) As Integer Private Sub Timer1_Timer() If GetAsyncKeyState(iKey) Then lblmessage.Caption = "yo" End Sub