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 , WMHotkey tutorial
Goto page 1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 11:03 am    Post subject: RegisterHotKey , WMHotkey tutorial This post has 1 review(s) Reply with quote

Welcome to the tutorial on RegisterHotkey using WMHotkey.

GetAsyncKeyState uses a timer, which uses more cpu power than a simple function w/o a timer.

Step 1) In the Type section you will see Private {private declations}.
So in the private declaration put this code
Code:
    Procedure WMHotkey(var msg: TWMHotkey);
      message WM_HOTKEY;

This code just declares WMHotkey procedure.

Step 2) RegisterHotkey. In FormCreate procedure put this code.
Code:
if not RegisterHotKey(Handle, 1, MOD_CONTROL, VK_f12) then
begin
ShowMessage('Cant Assign CTRL+F12 as hotkey!');
end;

This registers the HotKey to your window(handle), sets hotkey value to 1
(if your going to add another hotkey change this to 2,3,4 etc.) MOD_CONTROL is making sure the ctrl key is held down. VK_f12 is the key that must be pressed with ctrl.

You may add more HotKeys by repeating this code with different hotkey values.

Also if Ctrl + F12 is assigned already the ShowMessage will pop up.

Step 3) WMHotkey Function.
Code:
procedure TForm1.WMHotkey (Var msg: TWMHotkey);
begin
  if msg.HotKey = 1 then begin
//do something
    end;
end;


This procedure makes it so when you press the Hotkey assigned to 1, your actions are done.

3 Simple Steps.
No extra Cpu Power.

_________________
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Tue Jul 24, 2007 11:07 am    Post subject: Reply with quote

Was this really necessary? This information can be found easily on the internet. If you really want to write tutorials, do it on something that is complicated to do, or on something that there isn't a lot of documentation on the subject.
_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 11:11 am    Post subject: Reply with quote

People keep released GetAsync Tuts.

This method is more effecient, so i shared it with people.

Theres documentation on everything. This is the internet not a book.

_________________
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Tue Jul 24, 2007 11:18 am    Post subject: Reply with quote

You will be surprised that there's things that are not well documented, and if you do a tutorial on 1 of those things, then I will be thankful to you. =)
_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 11:19 am    Post subject: Reply with quote

Give me an example, what do you want.

If you want it and its practical i will learn and make it.

message me your ideas

_________________
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: Tue Jul 24, 2007 11:29 am    Post subject: Reply with quote

whats the diffrent and i dont really understand how it works...
the last function tells if Ctrl+12 was pressed do .... end;?
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 11:41 am    Post subject: Reply with quote

jesus are you retarded?

the //your code here thing

IS WHERE YOU PUT YOUR CODE

the difference is there is no timer running every 20 ms, this causes cpu power loss.

its simple

_________________
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Tue Jul 24, 2007 11:49 am    Post subject: Reply with quote

GetAsyncKeyState require you to have focus on your program, if you use RegisterHotKey your hotkey should work even if you don't have focus on your program.

@blankrider, you would not be able to do a "tutorial" on what I need, it's beyond you + you don't code in C or assembly.

_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 11:54 am    Post subject: Reply with quote

what do you need?
_________________
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Tue Jul 24, 2007 12:05 pm    Post subject: Reply with quote

Okay blankrider, well I really would like to use KdDebuggerEnabled/KdDisableDebugger but unfortunately I had a hard time to find information on those Native API's , the syntax and from where it's defined (I think I found this part), BUT I can't get it to work. So please can you help me Razz . Well from the start I know you are going to fail, since you can't do that in Delphi.

However if you want to write a tutorial that will be kinda useful. I suggested Kasper to add some anti-debugger tricks, so he's probably going to use IsDebuggerPresent. So you could make a tutorial how to make this function always return false (No Debugger). This can be archived with a plug-in but it's more fun doing it by yourself. Smile

_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 12:14 pm    Post subject: Reply with quote

now the KdDebuggerEnabled isnt that difficult because its a boolean

so just use KdDebuggerEnabled = FALSE/TRUE;

i hope you didnt have problem with that one.

http://www.reactos.org/generated/doxygen/d4/d99/kdmain_8c.html#a11

that is a good page.

they are both defined in kdmain.c or ntoskrnl.dll

http://www.reactos.org/generated/doxygen/dc/d51/kdmain_8c-source.html

^^^^kdmain.c

_________________
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Tue Jul 24, 2007 12:18 pm    Post subject: Reply with quote

Yeah, I forgot to tell you I'm using Windows XP not reactos Rolling Eyes Even though the syntax will probably be the same. Anyways, just forget about it.
_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jul 24, 2007 12:20 pm    Post subject: Reply with quote

try it out. it will most likely be the same so xp programs using it could run on reactos
_________________
Back to top
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Tue Jul 24, 2007 1:16 pm    Post subject: Reply with quote

No... just.... no.
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Tue Jul 24, 2007 1:16 pm    Post subject: Reply with quote

UnLmtD wrote:
GetAsyncKeyState require you to have focus on your program,


No it doesn't.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
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
Goto page 1, 2, 3, 4, 5  Next
Page 1 of 5

 
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