RT?

解决方案 »

  1.   

    OpenProcess
    TerminateProcess
    这两个API
      

  2.   

    nt核心要提升权限!
    中国程序员与老外的明显水平差距:
    processor Explorer 
    http://www.sysinternals.com/files/procexpnt.zip
    进程间谍最新版(cbuilder编写) 
    http://www.516688.net/ergong/down/Processor2.sfx.exe
      

  3.   

    function TForm1.GetProID(ProName:String):int64;
    var p: pProcessInfo;
        ContinueLoop: BOOL;
        FSnapshotHandle: THandle;
        FProcessEntry32: TProcessEntry32;
        tmp:String;
    begin
      result:=0;
      try
        Up(ProName);
        FSnapshotHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS,0);
        FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);
        ContinueLoop := Process32First(FSnapshotHandle,FProcessEntry32);
        while ContinueLoop do
        begin
          New(p);
          tmp:=FProcessEntry32.szExeFile;
          Up(tmp);
          if ProName=tmp then
          begin
            result:= FProcessEntry32.th32ProcessID;
            break;
          end;
          ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32);
        end;
      except
      end;
    end;procedure TForm1.KillProByName(proname:String);
    var
      HProcess: Thandle;
      uExitCode: int64;
      ID:int64;
    begin
      try
        ID := GetProID(proname);
        if ID>0 then
          hProcess := openprocess(PROCESS_TERMINATE,FALSE,ID);
        if TerminateProcess(hProcess,3838) then
        begin
          //删除进程成功
        end;
      except
      end;
    end;
      

  4.   

    UP是我转换大写字母用的function TForm1.UP(var str:String):String;
    var j:integer;
    begin
      try
        for j := 1 to length(str) do
          str[j] := UpCase(str[j]);
      except
      end;
    end;
      

  5.   

    var p: pProcessInfo;
     New(p);
    两处错误?
    怎么回事?
      

  6.   

    OpenProcess
    TerminateProcess
      

  7.   

    一般就是OpenProcess和TerminateProcess除了系统服务要AdjustToken的Debug权限,其他的足够了