var  
  SI : TStartupInfo;  
  PI : TProcessInformation;  
  pid:DWORD;  
begin  
  ZeroMemory(@SI, SizeOf(SI));  
  //ZeroMemory宏用0来填充一块内存区域  SizeOf//Pascal的一种内存容量度量函数  
  ZeroMemory(@PI, SizeOf(PI));  
  SI.cb := SizeOf(SI);  
  if CreateProcess(nil,'d:/CALC.EXE', nil, nil, FALSE, 0 ,nil,nil, SI, PI) then  
   begin  
     Pid := pi.dwProcessId;  //获取打开文件的PID  
     ShowMessage(IntToStr(pid));//显示PID值  
     CloseHandle(PI.hProcess);  
     CloseHandle(PI.hThread);  
   end;  
end;  

  

相关文章:

  • 2021-10-02
  • 2022-12-23
  • 2021-12-26
  • 2021-10-10
  • 2022-12-23
  • 2021-06-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
相关资源
相似解决方案