procedure TForm1.Button2Click(Sender: TObject);
var
Hdl: HWND;
entry : PROCESSENTRY32;
ID : cardinal;
ListAjout : TListItem;
begin
Listbox1.Clear;
hdl := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
entry.dwSize := sizeof(entry);
ListAjout := ListView1.Items.Add;
if Process32First(hdl,entry) then
Begin;
with listview1 do
Begin
ListAjout.Caption := (entry.szExeFile);
ListAjout.SubItems.Add(inttostr(entry.th32ProcessID));
Listbox1.items.add(entry.szexefile); // ajouter a une Tlistbox
Listbox2.items.add(inttostr(entry.th32ProcessID));
while Process32next(hdl,entry) do
begin
//ListAjout.Caption := (entry.szExeFile);
//ListAjout.SubItems.Add(inttostr(entry.th32ProcessID));
listbox1.items.add(entry.szexefile); // ajouter a une Tlistbox
Listbox2.items.add(inttostr(entry.th32ProcessID));
{with Form1.ListView1.Items do
begin
ListAjout.Caption := (entry.szExeFile);
ListAjout.subitems.add(inttostr(entry.th32ProcessID));
end;}
application.ProcessMessages;
end;
End;
Closehandle(hdl);
end;
end;
Partager