Is there an API call i can use to detect a keypress on my form when it isn't in focus. The idea of the keypress is in fact to bring it into focus. I want to bring the form to focus with something like (ctrl + shift + p)
cheers.
Printable View
Is there an API call i can use to detect a keypress on my form when it isn't in focus. The idea of the keypress is in fact to bring it into focus. I want to bring the form to focus with something like (ctrl + shift + p)
cheers.
VB Code:
'In a module Public Declare Function GetAsyncKeyState Lib "user32" _ (ByVal vKey As Long) As Integer 'In a timer control on your form Private Sub Timer1_Timer() Dim ControlState, ShiftState, PState As Integer ControlState = GetAsyncKeyState(vbKeyControl) ShiftState = GetAsyncKeyState(vbKeyShift) PState = GetAsyncKeyState(vbKeyP) If ControlState < 0 And ShiftState < 0 And PState < 0 Then Me.WindowState = 0 MsgBox "Shift-Ctrl-P have been pressed!! WooHoo!!" End If End Sub
You'll need a fairly low interval for it to work right, there may be an easier way, but I'm not sure what it would be....