[RESOLVED] shortcut key "F7", even if app on minimiz, tray or in background
ok i have a full app that i want to add an "F7" shortcut key. when the use press "F7" then frmshortactive.show
here is the problem, i wanat to have this shortcut to activate even if my app is minimized in background or in tray
how would i do this?
Re: shortcut key "F7", even if app on minimiz, tray or in background
Can it be done? If i am using MS Word with ur app in the background it wont let F7 get to your app, cos it is Spell check in Word. I dont think its possible.
Prove me wrong people :D
1 Attachment(s)
Re: shortcut key "F7", even if app on minimiz, tray or in background
Ok this is a project i did recently so use it as you please.
AutoClick.rar is the full project.
FrmCAPM.rar is the form i used and has the code.
Re: shortcut key "F7", even if app on minimiz, tray or in background
Here is some stuff on the web about keyboard hooks (which is what you want to be using).
Re: shortcut key "F7", even if app on minimiz, tray or in background
All you would have to do is use is the GetAsyncKeyState API. It reads input directly from your keyboard rather than use window messaging (which the Form_KeyPress, Form_KeyDown, and Form_KeyUp use), which means it'll work even if your app is not in focus. DirectInput can acheive the same thing, only it would be more code, yet would be more efficient. This is easier for you to use.
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Private Const Key_F7 As Long = 118
Private Sub Timer1_Timer()
Dim Key As Integer
Key = GetAsyncKeyState(Key_F7)
If Key = -32767 Then
MsgBox "You pressed F7"
frmshortactive.Show
End If
End Sub
It's that easy ;)
Re: shortcut key "F7", even if app on minimiz, tray or in background
Thx Jacob, that was what i was looking for i just chaged it to sut me,
I_Love_My_Vans, they way jacob did is when you using "word" and click on F7 for spell check then what will happend is that the spell check will comup like normal and in my app the code will take place just in the background of "word"
:)
RESOLVED