c gets a simple instance of where the cursor is on the screen

  • 2020-05-27 07:00:22
  • OfStack

You need to call win32api. winform and wpf are common

The code is as follows:


[DllImport("user32.dll")]
public static extern bool GetCursorPos(out POINT lpPoint);
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
    public int X;
    public int Y;
    public POINT(int x, int y)
    {
        this.X = x;
        this.Y = y;
    }
}


Related articles: