fHProcess:= GetProcessHandle('FileName'); if fHProcess <> 0 then begin try //Сделать что то с хендлом finally CloseHandle(fHProcess); end; end;