柔城

SOSOFT articles

c#获取光标在屏幕中位置

需要调用win32api,winform、wpf通用

代码如下:

 1 [DllImport("user32.dll")]
 2 public static extern bool GetCursorPos(out POINT lpPoint);
 3 
 4 [StructLayout(LayoutKind.Sequential)]
 5 public struct POINT
 6 {
 7     public int X;
 8     public int Y;
 9     public POINT(int x, int y)
10     {
11         this.X = x;
12         this.Y = y;
13     }
14 }

 http://www.cnblogs.com/sosoft/

posted on 2013-12-24 00:30  柔城  阅读(5164)  评论(1编辑  收藏  举报

导航