Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Simular un clic en los botones (izquierdo, central y derecho) del ratón (https://www.clubdelphi.com/foros/showthread.php?t=80410)

dec 07-06-2006 20:30:11

Simular un clic en los botones (izquierdo, central y derecho) del ratón
 
Simula que se ha pulsado un botón del ratón, sea el izquierdo, el central (la rueda del ratón) o el derecho:

Código Delphi [-]
uses
  Windows;

type
  { Botones del ratón }
  TBotonesRaton = (brIzquierdo, brCentral, brDerecho);

procedure ClicBotonRaton(boton: TBotonesRaton);
begin
  case boton of
    brIzquierdo: begin
      mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
      mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
    end;
    brCentral: begin
      mouse_event(MOUSEEVENTF_MIDDLEDOWN,0,0,0,0);
      mouse_event(MOUSEEVENTF_MIDDLEUP,0,0,0,0);
    end;
    brDerecho: begin
      mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
      mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
    end;
  end;
end;


La franja horaria es GMT +2. Ahora son las 11:17:37.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi