J
jadesun
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
TLHelp32,Controls, Forms, Dialogs, StdCtrls, XPMenu, ComCtrls;
type
TProcessInfo = Record
ExeFile : String;
ProcessID : DWORD;
end;
pProcessInfo = ^TProcessInfo;
type
TForm1 = class(TForm)
XPMenu1: TXPMenu;
Button1: TButton;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var lppe: TProcessEntry32;
found : boolean;
Hand : THandle;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
found := Process32First(Hand,lppe);
while found do
begin
listbox1.Items.Add(StrPas(lppe.szExeFile));
found := Process32Next(Hand,lppe);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Exehandle: THandle;
s : String;
i:integer;
begin
i:=listbox1.ItemIndex ;
s := listbox1.Items;
ExeHandle:=Findwindow(nil,pchar(s));
if ExeHandle<>0 then
PostMessage(ExeHandle,WM_CLOSE,0,0);
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
TLHelp32,Controls, Forms, Dialogs, StdCtrls, XPMenu, ComCtrls;
type
TProcessInfo = Record
ExeFile : String;
ProcessID : DWORD;
end;
pProcessInfo = ^TProcessInfo;
type
TForm1 = class(TForm)
XPMenu1: TXPMenu;
Button1: TButton;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var lppe: TProcessEntry32;
found : boolean;
Hand : THandle;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
found := Process32First(Hand,lppe);
while found do
begin
listbox1.Items.Add(StrPas(lppe.szExeFile));
found := Process32Next(Hand,lppe);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Exehandle: THandle;
s : String;
i:integer;
begin
i:=listbox1.ItemIndex ;
s := listbox1.Items;
ExeHandle:=Findwindow(nil,pchar(s));
if ExeHandle<>0 then
PostMessage(ExeHandle,WM_CLOSE,0,0);
end;
end.