Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. uses
  2. ...
  3. , Windows
  4. , ...
  5. ;
  6.  
  7. type
  8. TMouseBtnType = (mbLeft, mbMiddle, mbRight);
  9.  
  10. const
  11. MOUSE_BTN_VKEYS: Array [TMouseBtnType] of Integer = (VK_LBUTTON, VK_MBUTTON, VK_RBUTTON);
  12.  
  13. (* This function returns true when the specified mouse button is pressed *)
  14. function IsMouseBtnDown(const AMouseBtn: TMouseBtnType): Boolean;
  15. begin
  16. Result := GetAsyncKeyState(MOUSE_BTN_VKEYS[AMouseBtn])
  17. AND $8000 <> 0;
  18. end;
  19.  
  20.  
  21. (* This function returns true when any of the mouse button is pressed *)
  22. function IsMouseBtnDown: Boolean;
  23. begin
  24. Result := (GetAsyncKeyState(VK_LBUTTON)
  25. OR GetAsyncKeyState(VK_MBUTTON)
  26. OR GetAsyncKeyState(VK_RBUTTON)
  27. )
  28. AND $8000 <> 0;
  29. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement