C# GetWindowThreadProcessId用法
来源:互联网 发布:java split . 编辑:程序博客网 时间:2024/05/01 20:29
函数功能:该函数返回创建指定窗口线程的标识和创建窗口的进程的标识符,后一项是可选的。
函数原型;DWORD GetWindowThreadProcessld(HWND hwnd,LPDWORD lpdwProcessld);
参数:
hWnd:窗口句柄。
lpdwProcessld:接收进程标识的32位值的地址。如果这个参数不为NULL,GetWindwThreadProcessld将进程标识拷贝到这个32位值中,否则不拷贝。
返回值:返回值为创建窗口的线程标识。
C#中使用该函数首先导入命名空间:
using System.Runtime.InteropServices;
然后写API引用部分的代码,放入 class 内部
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID);
这个函数有两个参数,第一个参数是窗口句柄 由FindWindow获取,第二个参数是存放进程ID的变量。例如:
//获取计算器窗口句柄
IntPtr hwnd = FindWindow(null, "计算器");
if (hwnd != IntPtr.Zero)
{
int calcID;
//获取进程ID
GetWindowThreadProcessId(hwnd, out calcID);
MessageBox.Show(calcID.ToString());
}
else
{
MessageBox.Show("没有找到计算器窗口");
}
- C# GetWindowThreadProcessId用法
- C# GetWindowThreadProcessId用法 .
- C# GetWindowThreadProcessId用法
- GetWindowThreadProcessId用法
- GetWindowThreadProcessId用法
- GetWindowThreadProcessId
- GetWindowThreadProcessId
- GetWindowThreadProcessId
- GetWindowThreadProcessId Function
- GetWindowThreadProcessId 函数的应用
- 学习API--GetWindowThreadProcessId
- 函数说明(GetWindowThreadProcessId)08.11.1
- C# HashSet 用法、Hashtable用法
- 从窗口句柄获取进程句柄并终止进程GetWindowThreadProcessID
- GetWindowThreadProcessId 获得窗口所在进程ID和线程ID
- GetWindowThreadProcessId 获得窗口所在进程ID和线程ID
- C#中迭代器的用法
- c#类型用法
- 调用程序 submit
- Collaborative filtering with GraphChi
- IOS 预览功能(轻松实现对各种文本、图片等查看)
- Collaborative filtering with GraphChi
- Before You Refactor
- C# GetWindowThreadProcessId用法
- 编程之美 初赛第一场 竞价
- Transformations USACO
- 重定向与跳转的区别
- Webkit对Javascipt的执行优先级
- Collaborative filtering with GraphChi
- 第七周项目一
- 单机模式处理大数据,搜集一些好用的开源利器
- emacs c++