You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MouseHelper.cs 706 B

8 月之前
12345678910111213141516171819202122232425262728293031
  1. using System.Runtime.InteropServices;
  2. using System.Windows;
  3. namespace DamnOverSharp.Helpers
  4. {
  5. internal static class MouseHelper
  6. {
  7. [StructLayout(LayoutKind.Sequential)]
  8. public struct POINT
  9. {
  10. public int X;
  11. public int Y;
  12. public static implicit operator Point(POINT point)
  13. {
  14. return new Point(point.X, point.Y);
  15. }
  16. }
  17. [DllImport("user32.dll")]
  18. public static extern bool GetCursorPos(out POINT lpPoint);
  19. public static Point GetCursorPosition()
  20. {
  21. POINT lpPoint;
  22. GetCursorPos(out lpPoint);
  23. return lpPoint;
  24. }
  25. }
  26. }