| View previous topic :: View next topic |
| Author |
Message |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Thu Jun 19, 2008 9:00 am Post subject: RegisterHotKey or GetAsyncKeyState |
|
|
I saw that blankrider used RegisterHotKey, which I find more.. Tasty. Even though GetAsyncKeyState seems so much easier. Which is better?
--NOT TRYING TO BE A MOOCH--
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Jun 19, 2008 9:04 am Post subject: |
|
|
i prefer registerhotkey and so does alot of the C users. More delphi oriented will tell you GAK
_________________
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Thu Jun 19, 2008 9:10 am Post subject: |
|
|
Well, its mainly because I can understand RegisterHotKey, as GetAsyncKeyState is too... different.
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Thu Jun 19, 2008 10:15 am Post subject: |
|
|
| RegisterHotKey ofcourse, this way you will get WM_HOTKEY message when the hotkey is pressed, instead of looping forever...
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Thu Jun 19, 2008 11:06 am Post subject: |
|
|
You're still looping forver whether it's a getasynckeystate loop or a message loop.
In order to use registerhotkey and get messages, you have to create a window. A lot of DLLs don't make a window, so it's easier just to use getasynckeystate. if a program/dll does make a window, then it's already set up for receiving messages and all you have to do is add a hotkey case to the main switch statement.
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Jun 19, 2008 11:15 am Post subject: |
|
|
you don't have to make a window to use a message loop >.> Renkokuken has an example on here somewhere of a program that uses a message loop in a console.
_________________
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Thu Jun 19, 2008 1:22 pm Post subject: |
|
|
| HalfPrime wrote: | You're still looping forver whether it's a getasynckeystate loop or a message loop.
In order to use registerhotkey and get messages, you have to create a window. A lot of DLLs don't make a window, so it's easier just to use getasynckeystate. if a program/dll does make a window, then it's already set up for receiving messages and all you have to do is add a hotkey case to the main switch statement. |
But you use a message loop anyway, even if you don't use any hotkeys, so you should have only 1 loop, the message loop, instead of GetAsyncKeyState in a diffrent loop.
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Thu Jun 19, 2008 1:23 pm Post subject: |
|
|
| msdn wrote: | hWnd
Handle to the window that will receive WM_HOTKEY messages generated by the hot key. If this parameter is NULL, WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop. |
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Thu Jun 19, 2008 2:12 pm Post subject: |
|
|
I'm saoooo lazy...
Anyway... I keep getting undeclared identifier and all this crap when I use RegisterHotKey.
I included <windows.h>... hmm. Plus I get undeclared identifier for like... GetCursorPos etc..
also, in registerhotkey, I realized you have to use MOD_CONTROL, if I set it to null would it null the fact that you must press CTRL to use your hotkey?
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Thu Jun 19, 2008 2:16 pm Post subject: |
|
|
| Use MOD_IGNORE_ALL_MODIFIER. (notice that MOD_IGNORE_ALL_MODIFIER is 0x400, not NULL (0), so if this parameter is null it doesn't ignore modifiers)
|
|
| Back to top |
|
 |
|