⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 列表6.3.txt

📁 klinux书籍的配套光盘。可以学习学习。
💻 TXT
字号:
【列表6.3】来自HndSendMain.pas的摘录代码。
function SendCommand(ProcName : String;
                               SigValue : Integer) : Boolean;
var
 i : Integer;
 L : TList;
 PRec : PProcInfoRec;
 ErrResult : Integer;
begin
 ErrResult :=0;
 { Get the process info if executing }
 L := GetProcessListByName(ProcName);
 if L.Count > 0
   then for i := 0 to L.Count -1 do
    begin
      PRec := L.Items[i];
     with PRec^ do
       begin
         if MessageDlg('Sending Signal',
            'Process ' + IntToStr(i + 1) + ' of ' + IntToStr(L.Count)
             + LF + LF
             + 'Send to this process?' + LF + LF
     + 'Process ID: ' + IntToStr(PID) + LF,
           mtConfirmation, [mbYes, mbNo], 0) = mrYes
        then ErrResult := kill(PID, SigValue);
        if ErrResult <> 0
          then MessageDlg('Error', 'Unable to perform this '
             + 'operation!', mtError, [mbOK], 0);
      end; { with }
   end { for }
  else begin
           ErrResult := -1;
           MessageDlg('Error', ProcName + ' not running',
           mtError, [mbOK], 0);
         end;
 L.Free;
 Result := ErrResult = 0;
end;
procedure THndSenderForm. GreenBtnClick(Sender: TObject);
begin
 SendCommand('HndRecvr', SIGUSR1);
end;
procedure THndSenderForm. RedBtnCtick(Sender: TObject);
begin
  SendCommand('HndRecvr', SIGUSR2);
 end;
 procedure THndSenderForm. IntBtnClick(Sender: TObject);
 begin
   SendCommand('HndRecvr', SIGINT);
 end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -