1 using System; 2 using System.Drawing; 3 using System.Runtime.InteropServices; 4 using System.Threading; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 { 10 static void Main(string[] args) 11 { 12 while (true) 13 { 14 Point point; 15 GetCursorPos(out point); 16 Console.WriteLine("x:{0},y:{1}", point.X, point.Y); 17 Thread.Sleep(1000); 18 } 19 } 20 [DllImport("User32")] 21 public static extern bool GetCursorPos(out Point point); 22 } 23 }