lukasz108min
Użytkownik
- Dołączył
- Grudzień 24, 2012
- Posty
- 9
Witam, napisałem według poradnika z forum hooka na klawiature :
Błąd wywala na czerwonej linijce
treść błędu : [DCC Error] Unit2.pas(48): E2010 Incompatible types: 'NativeInt' and 'Integer'
Kod:
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, unit1;
type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
MainHook : HHOOK;
function KeyHook(Code: Integer; wParam : WPARAM; lParam : LPARAM): Longint; stdcall;
implementation
{$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
Form1.Memo1.Text := Form1.Memo1.Text + chr(Buffer.paraml); //Tutaj Wybieramy Gdzie mają sie zapisywać wciskane klawisze, domyslnie jest to Form1.Memo1 jezeli masz inną nazwe formy domyslnej lub inną nazwę memo musisz to zmienić
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
[COLOR="#FF0000"]MainHook := SetWindowsHookEx(wh_JournalRecord, KeyHook, HInstance, 0);[/COLOR]
end;
procedure TForm2.FormDestroy(Sender: TObject);
begin
UnhookWindowsHookEx(MainHook);
end;
end.
treść błędu : [DCC Error] Unit2.pas(48): E2010 Incompatible types: 'NativeInt' and 'Integer'