PDA

Click to See Complete Forum and Search --> : [Delphi] Getting Running processes into a List Box and Kill Selected ??


Shady Soft
Jul 21st, 2005, 11:18 AM
Hello every one!
I don't know if i can ask questions in this Forum..But i will any way :rolleyes:
- I want to ask this:
I have 1 Listbox and 2 Buttons
The first button get running processes into a list box and the other terminate selected process!

Hack
Jul 21st, 2005, 11:57 AM
This is not the proper place for a question, but I can move it to where it needs to go. My question is: Is this a Delphi specific question? If not, what language are you referring to?

Thanks, and I'll move this as appropriate. :)

Shady Soft
Jul 21st, 2005, 12:18 PM
This is not the proper place for a question, but I can move it to where it needs to go. My question is: Is this a Delphi specific question? If not, what language are you referring to?

Thanks, and I'll move this as appropriate. :)
Yes my question is how can i make a processes nmanager in Delphi...
Sorry if i post the question in a Code Bank forum..But there is no other Forum to post Delphi questions :rolleyes:

Hack
Jul 21st, 2005, 02:19 PM
Moved from CodeBank - Other

No, there isn't a Delphi specific forum section. The only other place that I believe this would be appropriate is in General Developer.

Madboy
Jul 21st, 2005, 04:28 PM
You may populate the listbox with the win32 process list, by using:

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;

Im guessing to kill the process you desire, simply call the Kill method on the selected listbox item :afrog: