unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 =
class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
DesktopDC: hDC;
implementation
{$R *.dfm}
function GetPixelFarbe: TColor;
var
Pos: TPoint;
begin
GetCursorPos(Pos);
Result := GetPixel(DesktopDC, Pos.X, Pos.Y);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DesktopDC := GetDC(0);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
x, y: integer;
begin
if GetPixelFarbe = clGreen
then
mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
end;
end.