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 


[Delphi] Making Hotkeys

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Thu May 21, 2009 5:06 am    Post subject: [Delphi] Making Hotkeys Reply with quote

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

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Thu May 21, 2009 5:27 am    Post subject: Reply with quote

Do you know how yo use API's ?
if you do RegisterHotkey might help you
http://msdn.microsoft.com/en-us/library/ms646309.aspx
Back to top
View user's profile Send private message
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Thu May 21, 2009 5:41 am    Post subject: Reply with quote

1qaz wrote:
Do you know how yo use API's ?
if you do RegisterHotkey might help you
http://msdn.microsoft.com/en-us/library/ms646309.aspx


No I don't know how to use API'S Embarassed
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Thu May 21, 2009 9:44 am    Post subject: Reply with quote

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

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Thu May 21, 2009 11:44 am    Post subject: Reply with quote

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
View user's profile Send private message
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Thu May 21, 2009 11:49 am    Post subject: Reply with quote

Thanks, that helped me alot Smile
Back to top
View user's profile Send private message
gunminiho
Expert Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Thu May 21, 2009 5:51 pm    Post subject: Reply with quote

by the way you need to import an library:

Code:

uses
  SysUtils,
  Classes,
  Windows; // <<<< import windows
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