| View previous topic :: View next topic |
| Author |
Message |
DaNemeziz Master Cheater
Reputation: 0
Joined: 29 Sep 2007 Posts: 430
|
Posted: Sun Nov 30, 2008 5:33 am Post subject: [VB.NET] Hotkeys |
|
|
I have buttons like these ...
| Code: | Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub |
... but now I want to make hotkeys which can be pressed while the bot is minimized.
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sun Nov 30, 2008 5:36 am Post subject: |
|
|
RegisterHotkey or make a timer with 50 msec which checks for this:
| Code: | if(GetAsyncKeyState([hotkey]){
// do whatever
} |
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Nov 30, 2008 2:31 pm Post subject: |
|
|
RegisterHotKey and respond to the WM_HOTKEY message.
or
Create a thread, or timer, and check with GetAsyncKeyState
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Sun Nov 30, 2008 8:46 pm Post subject: |
|
|
i would probably do...a background worker. Make sure you know how to multi-thread. sleep with idk i guess 10-500. Yup. That should be good (don't forget the getasync thingy)
_________________
|
|
| Back to top |
|
 |
Luigi Grandmaster Cheater Supreme
Reputation: 1
Joined: 24 Mar 2008 Posts: 1082
|
Posted: Sun Nov 30, 2008 10:16 pm Post subject: |
|
|
I've tried getanskeystate and registerhotkeys method, both have failed.
I am having this problem too.
|
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Mon Dec 01, 2008 3:05 am Post subject: |
|
|
i'm presuming you're talking about global hotkeys, not regular old hotkeys. if you are play around with this source i have for a smuggle program for MapleStory. i got the code from a website i checked, and you can change the hotkey by clicking on the label. that's just a little run down on the program. (attached)
i know this probably isn't the best method, but hey it works.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Dec 01, 2008 10:42 am Post subject: |
|
|
| Luigi wrote: | I've tried getanskeystate and registerhotkeys method, both have failed.
I am having this problem too. |
Did you actually run it within a loop / timer? You have to check continually with GetAsyncKeyState
Did you respond to the WM_HOTKEY message for RegisterHotKey?
|
|
| Back to top |
|
 |
|