Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


RegisterHotKey or GetAsyncKeyState

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Thu Jun 19, 2008 9:00 am    Post subject: RegisterHotKey or GetAsyncKeyState Reply with quote

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
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Jun 19, 2008 9:04 am    Post subject: Reply with quote

i prefer registerhotkey and so does alot of the C users. More delphi oriented will tell you GAK
_________________
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Thu Jun 19, 2008 9:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Jun 19, 2008 10:15 am    Post subject: Reply with quote

RegisterHotKey ofcourse, this way you will get WM_HOTKEY message when the hotkey is pressed, instead of looping forever...
Back to top
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Thu Jun 19, 2008 11:06 am    Post subject: Reply with quote

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
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Jun 19, 2008 11:15 am    Post subject: Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Jun 19, 2008 1:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Thu Jun 19, 2008 1:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Thu Jun 19, 2008 2:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Jun 19, 2008 2:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites