📄 列表5.13.txt
字号:
【列表5.13】GetPID 程序代码。
{
frmGetPID - Get and display summary information for this process
}
unit frmGetPID;
interface
uses
SysUtils, Types, Classes. QGraphics, QControls, QForms. QDialogs, Libc,
QStdCtrls;
type
TGetPIDMainForm = class(TForm)
InfoMemo: TMemo;
InfoBtn: TButton;
ExitBtn: TButton;
Label1: TLabel;
procedure ExitBtnClick(Sender: TObject);
procedure InfoBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
GetPIDMainForm: TGetPIDMainForm;
implementation
{SR *.xfm}
procedure TGetPIDMainForm. ExitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TGetPIDMainForm. InfoBtnClick(Sender: TObject);
var
p : PChar;
PPWRec : PPasswordRecord;
pid : Integer;
uid : Integer;
ppid : Integer;
pgroup : Integer;
ppgroup : Integer;
begin
pid := getpid;
uid := getuid;
ppid :: getppid;
pgroup := getpgid(pid);
ppgroup := getpgid(ppid);
PPWRec := getpwuid(uid);
p := PPWRec^.pw_name;
with InfoMemo. Lines do
begin
Clear;
Add(' User information:');
Add(' Login name: ' + p);
Add(' User ID: ' + IntToStr(uid));
Add('');
Add(' Current process:');
Add(' Process ID: ' + IntToStr(pid));
Add(' Group ID: ' + IntToStr(pgroup));
Add('');
Add(' Parent of current process:');
Add(' Process ID: ' + IntToStr(ppid));
Add(' Group ID: ' + IntToStr(ppgroup));
end; { with }
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -