“Goto Process” menu item in Task Manager is one of the frequently used stuff. isn’t it? ;) Its shows a list of windows currently displayed in desktop and by using “Goto Process”, we can find the process which owns the window. Have a look at it and feel refreshed! Ever thought of doing the same? How can we identify the process which owns the window by using window handle?


You can use the api – GetWindowThreadProcessId(). If you provide the window handle, if will return back the Id of the process which owns that window. Have a look at code snippet.

// Get the Id of Process which owns Windows Desktop.
DWORD dwProcessId = 0;
GetWindowThreadProcessId( ::GetDesktopWindow(),
                          &dwProcessId );


Pretty good! nah? ;)


Targeted Audience – Intermediate.