• Declare nas uses:

Código PHP:
TlHelp32 
Código PHP:
function GetPID(ProcessNamestring): DWORD//Função obter o ID do Processo (PID)
var MyHandleTHandle;
StructTProcessEntry32;
begin
Result
:=0;
try
MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROC ESS0);
Struct.dwSize:=Sizeof(TProcessEntry32);
if 
Process32First(MyHandleStructthen
if Struct.szExeFile=ProcessName then
begin
Result
:=Struct.th32ProcessID;
Exit;
end;
while 
Process32Next(MyHandleStruct) do
if 
Struct.szExeFile=ProcessName then
begin
Result
:=Struct.th32ProcessID;
Exit;
end;
except on exception do
Exit; 
end;
end
  • Para utilizar

Código PHP:
PID:= GetPID('main.exe'); 
Barbada, resto é com vocês.