unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
StdCtrls, ExtCtrls, Windows;
type
{ TForm1 }
TForm1 =
class(TForm)
Memo1: TMemo;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
PopupMenu1: TPopupMenu;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure keytimer(WND: Hwnd; uMsg: DWord; IdEvent: DWord; dwTimer: DWord);
stdcall;
Far;
begin
if Form1.Active
then
begin
if getasynckeystate (VK_MBUTTON) <> 0
then
begin
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
Var TimerHandle: THandle;
Begin
TimerHandle := SetTimer(0, 0, 100, @keytimer);
end;
procedure TForm1.FormDestroy(Sender: TObject);
Var TimerHandle: THandle;
begin
KillTimer(0, TimerHandle);
end;
end.