Know if the mouse is pressed  

Send By: Regent Beaulieu
Web : N.A.
Email: rbeaulieu@voximage.com
Date: 18/04/01

Tip accessed 412 times

 


This is useful to know, inside an event when the user continues with the button pressed...
Or for example, to abort a repetitive loop in which one doesn't leave to our application that processes messages that generate the events that would be necessary to stop this loop and without having necessity to execute the feared Application.ProcessMessages...



 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
   Shift: TShiftState; X, Y: Integer);
 begin
   {Mientras el ratón esté pulsado...}
   {While the mouse is pressed...}
   while HiWord(GetAsyncKeyState(VK_LBUTTON))<>0 do
     Caption:='Pulsado/Pressed';
   Caption:='No Pulsado / Released';
 end;