鹿我所录的博客

记录我在学习C#中的点点滴滴,记录下以备后来人借鉴。

 

2014年3月30日

C# 图像处理: 获取当前活动窗口句柄,获取窗口大小及位置

摘要: 需调用API函数需在开头引入命名空间 using System.Runtime.InteropServices;获取当前窗口句柄:GetForegroundWindow()[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]public static extern IntPtr GetForegroundWindow();返回值类型是IntPtr,即为当前获得焦点窗口的句柄使用方法 : IntPtr myPtr=GetForegroundWindow();获取到该窗口句柄后,可以对该窗 阅读全文

posted @ 2014-03-30 19:43 鹿我所录 阅读(11152) 评论(0) 推荐(0) 编辑

导航