main loop hooks example ?? lazarus / 8-Other ---------------------------------------------------------------------- bruce0829 · 2010-07-20 22:25 dear all does anybody can give me the true example for "main loop hooks" (in Linux) ?? Thanks in advance about "main loop hooks" http://wiki.lazarus.freepascal.org/Main_Loop_Hooks http://wiki.freepascal.org/Talk:Main_Loop_Hooks unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, LCLIntf, InterfaceBase, LCLType, LMessages; const WH_KEYBOARD_LL =13; WH_MOUSE_LL =14; type   { TForm1 }   TForm1 = class(TForm)     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);     procedure FormCreate(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; TMyCallbackObject = class(TObject) public   procedure MyCallback(AData: PtrInt; AFlags: dword); end; var   Form1: TForm1;   InstancePtr: TMyCallbackObject;   MyPEventHandler: PEventHandler; //uses InterfaceBase implementation { TForm1 } procedure TMyCallbackObject.MyCallback(AData: PtrInt; AFlags: dword); begin   //???? end; procedure TForm1.FormCreate(Sender: TObject); begin   InstancePtr := nil;   //AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler:TWaitHandleEvent; AData: PtrInt): PEventHandler;     //how to do the mouse hook ??   MyPEventHandler:=AddEventHandler(??? , ???, @InstancePtr.MyCallback, ???); end; procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin   RemoveEventHandler(MyPEventHandler); end; initialization   {$I unit1.lrs} end.