unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, sSkinManager, ExtCtrls, mmSystem;
type
TForm1 =
class(TForm)
... <- Hier die ganzen Objekte
procedure Button1Click(Sender: TObject);
procedure TimerBlueOwnTimer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure TimerRedOwnTimer(Sender: TObject);
procedure TimerBlueEnemyTimer(Sender: TObject);
procedure TimerRedEnemyTimer(Sender: TObject);
procedure TimerDragonTimer(Sender: TObject);
procedure TimerBaronTimer(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
HookHandle: Cardinal = 0;
WindowHandle: Cardinal = 0;
implementation
uses Unit2;
// Nur ein Info Fenster
{$R *.dfm}
function KeyboardHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT;
stdcall;
begin
Result := CallNextHookEx(HookHandle, nCode, wParam, lParam);
case nCode < 0
of
TRUE:
exit;
FALSE:
if (wParam = VK_NUMPAD7)
then
ShowMessage('
TEST');
end;
end;
function InstallHook(Hwnd: Cardinal): Boolean;
stdcall;
begin
Result := False;
if HookHandle = 0
then begin
HookHandle := SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookProc, HInstance, 0);
WindowHandle := Hwnd;
Result := TRUE;
end;
end;
function UninstallHook: Boolean;
stdcall;
begin
Result := UnhookWindowsHookEx(HookHandle);
HookHandle := 0;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
InstallHook(
Handle);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UninstallHook;
end;