Efficient Way To Build Your Own Windows Process Viewer In Delphi With Excellent Component Suite
February 5, 2021 By Anbarasan
ometimes Developers want to list down or identify the process running in a machine programmatically. How to enumerate among the running processes and services quickly ? Don’t know how to do. Don’t worry. Для просмотра ссылки Войдиили Зарегистрируйся System Information Management Suite’s component helps to do that effectively and we will learn how to use the threads TSysProcMonThread and TSvcListMonThread to demonstrate the processes and services respectively.
Platforms: Windows.
Installation Steps:
You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.
February 5, 2021 By Anbarasan
ometimes Developers want to list down or identify the process running in a machine programmatically. How to enumerate among the running processes and services quickly ? Don’t know how to do. Don’t worry. Для просмотра ссылки Войди
Platforms: Windows.
Installation Steps:
You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.
- Navigate In RAD Studio IDE->Tools->GetIt Package Manager->select Components in Categories->Components->Trail -MiTec system Information Component Suite 14.3 and click Install Button.
- Read the license and Click Agree All. An Information dialog saying ‘Requires a restart of RAD studio at the end of the process. Do you want to proceed? click yes and continue.
- It will download the plugin and installs it. Once installed Click Restart now.
- Navigate to the System Information Management Suite trails setup, Demos folder which is installed during Get It installation e.g) C:UsersDocumentsEmbarcaderoStudio21.0CatalogRepositoryMiTeC-14.3DemosDelphi6
- Open the PV project in RAD studio 10.4.1 compile and Run the application.
- This Demo App shows how to list down the running Process and Services in your machine, enumerate among them and access its properties.
- TSysProcMonThread: Monitors system and provides running processes, CPU, memory and disk monitoring and provides system information.
- TSvcListMonThread: Monitors installed services and drivers in real-time and provides their properties.
- 2 TTabsheet’s one for viewing Process list in TListView and other for viewing Services in TListView .
- TButton to view the details of the process or service accordingly in a new child form.
- An instance SPM of TSysProcMonThread and SLM of TSvcListMonThread were created. And in regular interval of each thread the Process list and service list is refreshed and updated to the screen using the OnInterval Event handlers
- On each interval, the Process List( using TProcessRecord ) and Service List (using TServiceRecord) is added to the list view by clearing the existing list.
Код:
procedure Twnd_Main.RefreshProcList(Sender: TSysProcMonThread);
var
i: Integer;
r: TProcessRecord;
begin
PrcList.Items.BeginUpdate;
try
PrcList.Items.Clear;
for i:=0 to Sender.RecordCount-1 do begin
Sender.GetRecord(i,r);
with PrcList.Items.Add do begin
Caption:=r.Name;
if Is64 and (r.Platform<>64) then
Caption:=Caption+'*32';
SubItems.Add(Format('%d',[r.PID]));
SubItems.Add(FormatTicks(r.UserTime+r.KernelTime,False));
SubItems.Add(Format('%d KB',[r.VMCounters.WorkingSetSize div 1024]));
SubItems.Add(Format('%s',[r.CommandLine]));
end;
end;
if PrcList.Tag<>0 then
PrcList.AlphaSort;
finally
PrcList.Items.EndUpdate;
end;
end;
procedure Twnd_Main.RefreshSvcList(Sender: TSvcListMonThread);
var
i: Integer;
r: TServiceRecord;
begin
SvcList.Items.BeginUpdate;
try
SvcList.Items.Clear;
for i:=0 to Sender.RecordCount-1 do begin
Sender.GetRecord(i,r);
with SvcList.Items.Add do begin
Caption:=r.DisplayName;
if r.Typ=svcUnknown then
SubItems.Add(Format('%s (%d)',[cSvcType[r.Typ],r._Typ]))
else
SubItems.Add(cSvcType[r.Typ]);
SubItems.Add(cSvcStatus[r.Status]);
SubItems.Add(cSvcStartup[r.StartUp]);
SubItems.Add(r.ObjectName);
SubItems.Add(r.Name);
end;
end;
if SvcList.Tag<>0 then
SvcList.AlphaSort;
finally
SvcList.Items.EndUpdate;
end;
end;