| View previous topic :: View next topic |
| Author |
Message |
Pot.Smoking.Terrorist Expert Cheater
Reputation: 0
Joined: 15 Jun 2008 Posts: 175 Location: Germany
|
Posted: Thu May 21, 2009 5:06 am Post subject: [Delphi] Making Hotkeys |
|
|
Hi,
I'm a newbie in Delphi. Can anybody tell me how to make a hotkey in it?
for example: If I press Numpad 1 then execute command xx
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
|
| Back to top |
|
 |
Pot.Smoking.Terrorist Expert Cheater
Reputation: 0
Joined: 15 Jun 2008 Posts: 175 Location: Germany
|
Posted: Thu May 21, 2009 5:41 am Post subject: |
|
|
No I don't know how to use API'S
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu May 21, 2009 9:44 am Post subject: |
|
|
I don't know much about delphi but i think you don't have to import the api's
just adding to the uses section the name windows which means windows library
then you just write down RegisterHotkey(param1,param2);
but then you have to controls the window's messages through the window procedure and i think delphi creates it's window automatically
so i guess the simplest way for you is run a loop and in it use GetAsyncKeyState(<VirtualKeyCode>)
in case GetAsyncKeyState return true the key is pressed
|
|
| Back to top |
|
 |
gunminiho Expert Cheater
Reputation: 0
Joined: 15 Dec 2008 Posts: 144 Location: peru
|
Posted: Thu May 21, 2009 11:44 am Post subject: |
|
|
well if you wanna use HotKeys, i use them like this:
| Code: | procedure Main;
begin
@GChat:=pointer(GChattAddress);
while(true) do
begin
if GetAsyncKeyState(vk_f1)<>0 then // <--- GetAsyncKeyState //detects if a key is pressed obiously it has to be in an // infinite loop ( while(true) do)
begin
MessageBox(0, 'This is an example of HotKey!', 'Sucess!', MB_OK or MB_ICONERROR) else
sleep(150);
end;
sleep(30);
end;
end;
|
if you're using a dll, when you inject it to your process and press F1, a mesagebox will pop up with " This is an example of HotKey! "
Last edited by gunminiho on Thu May 21, 2009 11:49 am; edited 1 time in total |
|
| Back to top |
|
 |
Pot.Smoking.Terrorist Expert Cheater
Reputation: 0
Joined: 15 Jun 2008 Posts: 175 Location: Germany
|
Posted: Thu May 21, 2009 11:49 am Post subject: |
|
|
Thanks, that helped me alot
|
|
| Back to top |
|
 |
gunminiho Expert Cheater
Reputation: 0
Joined: 15 Dec 2008 Posts: 144 Location: peru
|
Posted: Thu May 21, 2009 5:51 pm Post subject: |
|
|
by the way you need to import an library:
| Code: |
uses
SysUtils,
Classes,
Windows; // <<<< import windows
|
|
|
| Back to top |
|
 |
|