• 获取打开文件的PID


    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;  
    

      

  • 相关阅读:
    053-649
    053-648
    053-647
    053-646
    053-645
    053-644
    053-643
    053-642
    053-641
    053-640
  • 原文地址:https://www.cnblogs.com/qingsong/p/4033166.html
Copyright © 2020-2023  润新知