GetWindowThreadProcessId function
Applies to: desktop apps only
Retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
Syntax
DWORD WINAPI GetWindowThreadProcessId( __in HWND hWnd, __out_opt LPDWORD lpdwProcessId );
Parameters
- hWnd [in]
-
Type: HWND
A handle to the window.
- lpdwProcessId [out, optional]
-
Type: LPDWORD
A 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.
Return value
Type:
Type: DWORD
The return value is the identifier of the thread that created the window.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 2/3/2012
error condition
what is the return value if there was an error?
[tfl - 06 04 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead, you should visit the MSDN Forums at http://forums.microsoft.com/MSDN, where such posts are welcomed and where you stand a much better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.
[tfl - 06 04 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead, you should visit the MSDN Forums at http://forums.microsoft.com/MSDN, where such posts are welcomed and where you stand a much better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.
- 4/2/2012
- soyuz
- 4/6/2012
- Thomas Lee
Get owner process
To find the path to the process that created the window see the implementation of GetWindowProcessImage here:
http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinModules%5cInfrastructure%5cSystemAPI.cpp
http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinModules%5cInfrastructure%5cSystemAPI.cpp
- 12/30/2009
- Asaf Shelly