The GetProcessId function retrieves the process identifier of the specified process.
void GetProcessId(
HANDLE Process
);
If the function succeeds, the return value is the process identifier of the specified process. If the function fails, the return value is zero.
FoxPro declaration:
DECLARE INTEGER GetProcessId IN kernel32 INTEGER hProcess
Looks like this function is available starting from Windows XP, not in earlier versions.
* * *
Another option is process enumeration. Having all running processes enumerated with all their Process Id and Process Handles available, you just search a handle in the list.
On my site I have two examples in member area:
Enumerating Processes -- WinNThttp://www.news2news.com/vfp/?example=162Enumerating Processes -- Win9*http://www.news2news.com/vfp/?example=164There should be something in UT archives on process enumeration too. Recently I saw a thread on this subject.