GetWindowThreadProcessId
2011-03-14 13:33
141 查看
GetWindowThreadProcessId
The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
意译:
找出某个窗口的创建者(线程或进程),返回创建者的标志符。
哪个线程创建了这个窗口,返回的就是这个线程的id号 (进程只有一个线程的话,那么线程标志符与进程标志符就是指同一个标志符)
可理解为找出某栋房屋的建筑工人的名字。
HWND hWnd,
LPDWORD lpdwProcessId
);
lpdwProcessId [out] 进程号的存放地址(变量地址) Pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not. (如果参数不为NULL,即提供了存放处--变量,那么本函数把进程标志拷贝到存放处,否则不动作。)
返回线程号,注意, lpdwProcessId 是存放进程号的变量。返回值是线程号, lpdwProcessId 是进程号存放处。
当然可以把答案再放到其它地方。如
DWORD PID;
PID=GetWindowThreadProcessId( hWnd, lpdwProcessId );
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
这个函数获得指定线程的标识符,此线程创建了指定的窗口,并且随机的产生了这个标识符.
lpdwProcessId Long,指定一个变量,用于装载拥有那个窗口的一个进程的标识符
hwnd Long,指定窗口句柄
delphi实例:
var
t: Thandle;
begin
t := FindWindow('Notepad2', nil);
ShowMessage(IntToStr(t));
memo1.lines.Add(IntToStr(GetWindowThreadProcessId(t, nil)));
编辑本段一、VC
--------------------------------------------------------------------------------The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
意译:
找出某个窗口的创建者(线程或进程),返回创建者的标志符。
哪个线程创建了这个窗口,返回的就是这个线程的id号 (进程只有一个线程的话,那么线程标志符与进程标志符就是指同一个标志符)
可理解为找出某栋房屋的建筑工人的名字。
1.函数原型
[/b] DWORD GetWindowThreadProcessId(HWND hWnd,
LPDWORD lpdwProcessId
);
2.参数
[/b]hWnd [in] (向函数提供的)被查找窗口的句柄.lpdwProcessId [out] 进程号的存放地址(变量地址) Pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not. (如果参数不为NULL,即提供了存放处--变量,那么本函数把进程标志拷贝到存放处,否则不动作。)
3.返回值
[/b] The return value is the identifier of the thread that created the window.返回线程号,注意, lpdwProcessId 是存放进程号的变量。返回值是线程号, lpdwProcessId 是进程号存放处。
当然可以把答案再放到其它地方。如
DWORD PID;
PID=GetWindowThreadProcessId( hWnd, lpdwProcessId );
4.函数相关信息
Header Declared in Winuser.h, include Windows.hImport library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
编辑本段二、VB声明
Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, lpdwProcessId As Long) As Long1、说明
The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window这个函数获得指定线程的标识符,此线程创建了指定的窗口,并且随机的产生了这个标识符.
2、返回值
Long,拥有窗口的线程的标识符3、参数表
参数 类型及说明lpdwProcessId Long,指定一个变量,用于装载拥有那个窗口的一个进程的标识符
hwnd Long,指定窗口句柄
delphi实例:
var
t: Thandle;
begin
t := FindWindow('Notepad2', nil);
ShowMessage(IntToStr(t));
memo1.lines.Add(IntToStr(GetWindowThreadProcessId(t, nil)));
相关文章推荐
- GetWindowThreadProcessId 获得窗口所在进程ID和线程ID
- GetWindowThreadProcessId用法(转)
- GetWindowThreadProcessId
- GetWindowThreadProcessId用法
- C# GetWindowThreadProcessId用法 .
- 学习API--GetWindowThreadProcessId
- GetWindowThreadProcessId 函数的应用
- GetWindowThreadProcessId
- 函数说明(GetWindowThreadProcessId)08.11.1
- GetWindowThreadProcessId用法
- GetCurrentThreadId GetCurrentProcessId GetWindowThreadProcessId
- GetWindowThreadProcessId 获得窗口所在进程ID和线程ID
- 查看进程所用的内存(使用GetWindowThreadProcessId取得进程ID,OpenProcess打开进程和GetProcessMemoryInfo取得内存信息)
- GetWindowThreadProcessId
- GetWindowThreadProcessId
- Windows API详解——GetWindowThreadProcessId 获得窗口所在进程ID和线程ID
- C# GetWindowThreadProcessId用法
- WinAPI: GetWindowThreadProcessId - 获取指定窗口的进程 ID 或线程 ID
- 从窗口句柄获取进程句柄并终止进程GetWindowThreadProcessID
- GetWindowThreadProcessId获得进程、线程ID