unit listprocess;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    ListBox1: TListBox;
    Edit1: TEdit;
    Button3: TButton;
    Button4: TButton;
    Edit2: TEdit;
    Button5: TButton;
    Button6: TButton;
    Edit3: TEdit;
    Label1: TLabel;
    Button7: TButton;
    Edit4: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
    listbox1.Items.Clear;
  //RunningProcessesList( listbox1.items, false);


end;

procedure TForm2.Button2Click(Sender: TObject);
begin
//edit1.Text:=floattostr(GetPidFromProcessName(listbox1.Items[listbox1.itemindex]));

end;

procedure TForm2.Button3Click(Sender: TObject);
begin
  listbox1.Items.Clear;
   //gettaskslist(listbox1.Items);
end;

procedure TForm2.Button4Click(Sender: TObject);
begin
//TerminateApp(GetPidFromProcessName(listbox1.Items[listbox1.itemindex]),5);
end;

procedure TForm2.Button5Click(Sender: TObject);
begin
//edit1.Text:=floattostr(GetPidFromProcessName(edit2.text));
end;

procedure TForm2.Button6Click(Sender: TObject);
var a: integer;
begin
with listbox1 do begin

for a:=0 to items.count-1 do begin
    if lowercase(listbox1.Items[a])=lowercase(edit3.Text) then begin
    edit3.Text:=inttostr(a);
    break;
    end;
end;

end;
end;

procedure TForm2.Button7Click(Sender: TObject);
var cod: cardinal;
begin
cod:=openprocess(PROCESS_QUERY_INFORMATION,false,strtoint(edit4.text));
showmessage(floattostr(cod));
end;

end.
