Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.

Display the Win32 Running Processes

Author: admin | Category: System, Windows API

//This is how we can display the win32 processes already running
//the memo will display the list of win32 running processes as processes tab in windows Task manager
 
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
uses
  TLHelp32;
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
var
  MyHandle: THandle;
  Struct: TProcessEntry32;
begin
  MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
  Struct.dwSize:=Sizeof(TProcessEntry32);
 
  while Process32Next(MyHandle, Struct) do
  begin
    Memo1.Lines.Add(Struct.szExeFile);
  end;
 
end;
 
end.

Tags: ,