Delphi XE的Windows.pas单元下有GetProcessID这个函数.在MSDN里能够搜索到GetWindowProcessIDRetrieves the identifier of the process that created the window.
DWORD GetWindowProcessID( ) throw(); Res See GetWindowThreadProcessID in the Windows SDK.Example Visual C++ Copy Code //The following example attaches an HWND to the CWindow object and //calls CWindow::GetWindowProcessID() to retrieve the id of the //process that created the windowCWindow myWindow; myWindow.Attach(hWnd); DWORD dwID = myWindow.GetWindowProcessID();
另外应该是GetWindowThreadProcessID
DWORD GetWindowProcessID( ) throw();
Res
See GetWindowThreadProcessID in the Windows SDK.Example
Visual C++ Copy Code
//The following example attaches an HWND to the CWindow object and
//calls CWindow::GetWindowProcessID() to retrieve the id of the
//process that created the windowCWindow myWindow;
myWindow.Attach(hWnd);
DWORD dwID = myWindow.GetWindowProcessID();