got longint of object, expected longint? =X lazarus / 8-Other ---------------------------------------------------------------------- daz · 2008-01-28 21:32 Exact error msg: project1.lpr(49,43) Error: Incompatible type for arg no. 2: Got "", expected "" Here's the function: function KeyboardHookProc(Code: Integer; WordParam,LongParam: LongInt):longint; stdcall; So, how can I fix that problem? :/ ---------------------------------------------------------------------- Bart · 2008-01-29 16:43 Maybe you try to pass a method as a paramater instead of a procedure? Bart ---------------------------------------------------------------------- daz · 2008-01-29 21:58 Well first off, let me just say that I'm trying to check for input like if they A key is pressed even when the program is minimized, and I found a delphi example (don't know where now unfortunately, but I did find another very different example) and I followed it exactly and it gave me the error. If there's an easier way to do it in lazarus please inform me, I'm still very new to pascal and delphi in general. What I've learned is that in delphi (don't know about lazarus) you have to hook yourself in to check for direct keypresses.. here's my entire project code, yes I am passing a function as one of the parameters but the example said to. Code: [Select] program project1; {$mode objfpc}{$H+} uses     windows,   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes, SysUtils, CustApp   { you can add units after this }; type   { TMyApplication }   TMyApplication = class(TCustomApplication)   protected     procedure DoRun; override;   public     constructor Create(TheOwner: TComponent); override;     destructor Destroy; override;     procedure WriteHelp; virtual;     function KeyboardHookProc(Code,WordParam,LongParam: LongInt):longint; stdcall;   end; { TMyApplication } procedure TMyApplication.DoRun; var ErrorMsg: String; var  KBHook: HHook; begin   // quick check parameters   ErrorMsg:=CheckOptions('h','help');   if ErrorMsg<>'' then begin     ShowException(Exception.Create(ErrorMsg));     Halt;   end;   // parse parameters   if HasOption('h','help') then begin     WriteHelp;     Halt;   end;   { add your program here }    KBHook:=SetWindowsHookEx(WH_KEYBOARD,            {callback —>} @KeyboardHookProc,                           HInstance,                           GetCurrentThreadId()) ;   // stop program loop   Terminate; end; constructor TMyApplication.Create(TheOwner: TComponent); begin   inherited Create(TheOwner);   StopOnException:=True; end; destructor TMyApplication.Destroy; begin   inherited Destroy; end; procedure TMyApplication.WriteHelp; begin   { add your help code here }   writeln('Usage: ',ExeName,' -h'); end; var   Application: TMyApplication; begin   Application:=TMyApplication.Create(nil);   Application.Title:='My Application';   Application.Run;   Application.Free; end. And even so, I have no idea how'd I check if a key was pressed after I hooked it.. bah. ---------------------------------------------------------------------- Leledumbo · 2008-01-30 08:43 windows API doesn't know any method (procedure/function of object, that's how it's called by fpc), write your KeyboardHookProc as a normal function.