View previous topic :: View next topic |
Author |
Message |
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 24, 2007 11:03 am Post subject: RegisterHotKey , WMHotkey tutorial |
|
|
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 |
|
|
UnLmtD Grandmaster Cheater Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Tue Jul 24, 2007 11:07 am Post subject: |
|
|
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 |
|
|
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 24, 2007 11:11 am Post subject: |
|
|
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 |
|
|
UnLmtD Grandmaster Cheater Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Tue Jul 24, 2007 11:18 am Post subject: |
|
|
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 |
|
|
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 24, 2007 11:19 am Post subject: |
|
|
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 |
|
|
Symbol I'm a spammer Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Tue Jul 24, 2007 11:29 am Post subject: |
|
|
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 |
|
|
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 24, 2007 11:41 am Post subject: |
|
|
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 |
|
|
UnLmtD Grandmaster Cheater Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Tue Jul 24, 2007 11:49 am Post subject: |
|
|
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 |
|
|
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 24, 2007 11:54 am Post subject: |
|
|
what do you need?
_________________
|
|
Back to top |
|
|
UnLmtD Grandmaster Cheater Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Tue Jul 24, 2007 12:05 pm Post subject: |
|
|
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 . 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.
_________________
|
|
Back to top |
|
|
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
|
Back to top |
|
|
UnLmtD Grandmaster Cheater Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Tue Jul 24, 2007 12:18 pm Post subject: |
|
|
Yeah, I forgot to tell you I'm using Windows XP not reactos Even though the syntax will probably be the same. Anyways, just forget about it.
_________________
|
|
Back to top |
|
|
HomerSexual Grandmaster Cheater Supreme Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 24, 2007 12:20 pm Post subject: |
|
|
try it out. it will most likely be the same so xp programs using it could run on reactos
_________________
|
|
Back to top |
|
|
the_undead Expert Cheater Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Tue Jul 24, 2007 1:16 pm Post subject: |
|
|
No... just.... no.
_________________
|
|
Back to top |
|
|
DeltaFlyer Grandmaster Cheater Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Tue Jul 24, 2007 1:16 pm Post subject: |
|
|
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 |
|
|
|