uses TLHelp32 procedure TForm1.Button1Click(Sender: TObject); var MyHandle: THandle; Struct: TProcessEntry32; begin try MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0); Struct.dwSize:=Sizeof(TProcessEntry32); if Process32First(MyHandle, Struct) then ListBox1.Items.Add(Struct.szExeFile); while Process32Next(MyHandle, Struct) do ListBox1.Items.Add(Struct.szExeFile); except on exception do ShowMessage('Error showing process list'); end end;
To kill the process we desire, simply call the Kill method on the selected listbox item
Source