|
|
| Use the tlHelp Functions to get the running tasks |
|
Step 1: add tlHelp to your uses clause: uses TlHelp32;
Step 2:
procedure TForm1.FormCreate(Sender: TObject);
var
Snapshot: THandle;
Entry: TProcessEntry32;
begin
Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if Snapshot = -1 then Exit;
Entry.dwSize := SizeOf(TProcessEntry32);
if not Process32First(Snapshot,Entry) then Exit;
Memo1.Lines.Add(Entry.szExeFile);
while Process32Next(Snapshot,Entry) do
Memo1.Lines.Add(Entry.szExeFile);
CloseHandle(Snapshot);
end;
|
|
Notes: Don't forget to Close your SnapShots just like you use FindClose() |