C#获取句柄
来源:互联网 发布:natapp mac 编辑:程序博客网 时间:2024/06/11 20:08
//获取窗口标题
[DllImport("user32", SetLastError = true)]
public static extern int GetWindowText(
IntPtr hWnd,//窗口句柄
StringBuilder lpString,//标题
int nMaxCount //最大值
);
//获取类的名字
[DllImport("user32.dll")]
private static extern int GetClassName(
IntPtr hWnd,//句柄
StringBuilder lpString, //类名
int nMaxCount //最大值
);
//根据坐标获取窗口句柄
[DllImport("user32")]
private static extern IntPtr WindowFromPoint(
Point Point //坐标
);
private void timer1_Tick(object sender, EventArgs e)
{
int x = Cursor.Position.X;
int y = Cursor.Position.Y;
Point p = new Point(x, y);
IntPtr formHandle = WindowFromPoint(p);//得到窗口句柄
StringBuilder title = new StringBuilder(256);
GetWindowText(formHandle, title, title.Capacity);//得到窗口的标题
StringBuilder className = new StringBuilder(256);
GetClassName(formHandle, className, className.Capacity);//得到窗口的句柄
this.textBox1.Text = title.ToString();
this.textBox2.Text = formHandle.ToString();
this.textBox3.Text = className.ToString();
}
- C# 获取句柄
- C#获取句柄
- C# 获取句柄
- c# 获取程序句柄
- C# 获取句柄程序
- C# 获取IE浏览器句柄
- C#获取进程的主窗口句柄
- C#获取控制台句柄的方法
- C#遍历进程获取主窗口句柄
- C#获取进程的主窗口句柄
- C#获取控制台句柄的方法
- C# 获取窗口句柄并且关闭应用程序
- C#获取进程的主窗口句柄
- C#遍历进程获取主窗口句柄
- C#获取进程的主窗口句柄
- 获取句柄
- C#句柄
- C#获取鼠标处的窗口(window)句柄
- 随时随地分享,无时不刻互联
- PHP Socket配置以及实例
- thinkphp 调错误 SaeKVClient.class.php SaeCounter.class.php mget($names) adminAction.class.php
- Base64加密
- MFC 读取文件的每一行的字符
- C#获取句柄
- 数据库判断是否有表,是否有数据
- Linux学习之--引导系统
- OutputCache缓存设置 条件 Cookies设置缓存无效
- VC 控制台程序中隐藏控制台窗口
- 老驱动模块在高版本内核编译下错误解决
- 结构体的定义及使用
- 使用code blocks连接mysql数据库的方法 .
- linux 时间日期