unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
but_StartHook: TButton;
but_StopHook: TButton;
Memo1: TMemo;
Label1: TLabel;
procedure but_StartHookClick(Sender: TObject);
procedure but_StopHookClick(Sender: TObject);
private
{ Private declarations }
hLib2: THandle;
DllStr1: string;
procedure DllMessage(var Msg: TMessage); message WM_USER + 1678;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TForm1 }
procedure TForm1.DllMessage(var Msg: TMessage);
begin
if (Msg.wParam =

{the 8 is the Backspace and the 13 if the Enter key, You'll need to
do some special handleing for a string}
DllStr1 := DllStr1 + Chr(Msg.wParam);
label1.Caption := DllStr1;
end;
procedure TForm1.but_StartHookClick(Sender: TObject);
type
TStartHook = function(MemoHandle, AppHandle: HWND): Byte;
var
StartHook1: TStartHook;
SHresult: Byte;
begin
hLib2 := LoadLibrary('HookLib.dll');
@StartHook1 := GetProcAddress(hLib2, 'StartHook');
if @StartHook1 = nil then Exit;
SHresult := StartHook1(Memo1.Handle, Handle);
if SHresult = 0 then ShowMessage('the Key Hook was Started, good');
if SHresult = 1 then ShowMessage('the Key Hook was already Started');
if SHresult = 2 then ShowMessage('the Key Hook can NOT be Started, bad');
if SHresult = 4 then ShowMessage('MemoHandle is incorrect');
end;
procedure TForm1.but_StopHookClick(Sender: TObject);
type
TStopHook = function: Boolean;
var
StopHook1: TStopHook;
begin
@StopHook1 := GetProcAddress(hLib2, 'StopHook');
if @StopHook1 = nil then
begin
ShowMessage('Stop Hook DLL Mem Addy not found');
Exit;
end;
if StopHook1 then
ShowMessage('Hook was stoped');
FreeLibrary(hLib2);
{for some reason in Win XP you need to call FreeLibrary twice
maybe because you get 2 functions from the DLL? ?}
FreeLibrary(hLib2);
end;
end.
vede ben bu bilgilerimi email yada hostta yollamak istiyoırum bu konuda yardimci olursaniz sevinirim