unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
[img]
implementation
{$R *.dfm}
uses TLHelp32;
function GetProcessPath(ProcID: DWORD):
string;
var
me32: TModuleEntry32;
hSnap : THandle;
begin
Result := '
';
hSnap := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ProcID);
if hSnap <> INVALID_HANDLE_VALUE
then
try
me32.dwSize := sizeof(me32);
Module32First(hSnap, me32);
Result := me32.szExePath;
finally
CloseHandle(hSnap);
end;
end;
procedure GetProcessSnapshot(sl: TStringList);
var
hSnap: THandle;
ProcEntry: TProcessEntry32;
fn: TFileName;
begin
hSnap:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if hSnap<>INVALID_HANDLE_VALUE
then
try
ProcEntry.dwSize:=SizeOf(ProcEntry);
if Process32First(hSnap, ProcEntry)
then
while Process32Next(hSnap, ProcEntry)
do begin
fn:=AnsiLowerCase(GetProcessPath(ProcEntry.th32ProcessID));
if (fn<>'
')
and (pos('
explorer.exe', fn)=0)
then
sl.Add(fn);
end;
finally
CloseHandle(hSnap);
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled:=False;
ListBox1.Clear;
GetProcessSnapshot(TStringList(ListBox1.Items));
Timer1.Enabled:=True;
end;
end.