need to add hotkeys
Page 1 of 1
need to add hotkeys
#5
Posted 23 April 2009 - 12:22 PM
#6
Posted 23 April 2009 - 05:01 PM
Look here:
http://www.youtube.c...h?v=Xr_cwdczOzo
Also test this:
Then for the hotkey
http://www.youtube.c...h?v=Xr_cwdczOzo
Also test this:
Private Sub Form_Load() KeyPreview = True End Sub
Then for the hotkey
If KeyCode = vbKeyF1 then Command1_Click
This post has been edited by firebolt: 23 April 2009 - 05:01 PM
#8
Posted 24 April 2009 - 07:29 AM
There's no reason to give up, it's really very simple.
Put this line in the general declarations:
Make a timer and make it's interval one millisecond, and in the timer put this code:
This first line is just used to refresh the API. If you don't put this line you will experience problems with the hotkey.
Then below that, put this code:
And that will work. But this code isn't perfect. The hotkey will be detected over and over and execute the code over and over, something you probably don't want to happen. So, put in some extra code to check if the key has been released or not, and if it hasn't, don't execute the code.
Put this line in the general declarations:
Private Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer
Make a timer and make it's interval one millisecond, and in the timer put this code:
This first line is just used to refresh the API. If you don't put this line you will experience problems with the hotkey.
GetAsyncKeyState KeyCode
Then below that, put this code:
If GetAsyncKeyState(KeyCode) Then
'HotKey pressed, put your code here
End If
And that will work. But this code isn't perfect. The hotkey will be detected over and over and execute the code over and over, something you probably don't want to happen. So, put in some extra code to check if the key has been released or not, and if it hasn't, don't execute the code.
Page 1 of 1

Start a new topic
Add Reply




MultiQuote


| 


