列出系统进程(注意uses TLHelp32) 然后 var lppe: TProcessEntry32; found : boolean; Hand : THandle; begin Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0); found := Process32First(Hand,lppe); while found do begin ListBox.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。 found := Process32Next(Hand,lppe); end; end;有了以上程序,能不能帮我写个结束进程的啊(选择一个item,单击“结束进程”结束!
如何查看系统当前的进程//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ procedure TForm_Main.Button24Click(Sender: TObject); var lppe: TProcessEntry32; ssHandle: THandle; AppFound: Boolean; begin Memo.Lines.Clear; ssHandle := CreateToolHelp32SnapShot(TH32CS_SNAPALL, 0); AppFound := Process32First(sshandle, lppe); while AppFound do begin //其中lppe.szExefile就是程序名********************************************** Memo.Lines.Add(ExtractFileName(lppe.szExeFile)); AppFound := Process32Next(ssHandle, lppe); end; end;
如何终止: //============================================================================== //强制终止某应用程序运行******************************************************** //============================================================================== procedure AppForceExit(const AppName: string); var lppe: TProcessEntry32; ssHandle: THandle; AppFound: Boolean; Wnd: HWND; begin ssHandle := CreateToolHelp32SnapShot(TH32CS_SNAPALL, 0); AppFound := Process32First(sshandle, lppe); while AppFound do begin //其中lppe.szExefile就是程序名********************************************** if UpperCase(ExtractFileName(lppe.szExeFile))=UpperCase(AppName) then begin Wnd := OpenProcess(PROCESS_ALL_ACCESS, true, lppe.th32ProcessID); TerminateProcess(Wnd, 0); end; AppFound := Process32Next(ssHandle, lppe); end; end;
然后
var lppe: TProcessEntry32;
found : boolean;
Hand : THandle;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
found := Process32First(Hand,lppe);
while found do
begin
ListBox.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。
found := Process32Next(Hand,lppe);
end;
end;有了以上程序,能不能帮我写个结束进程的啊(选择一个item,单击“结束进程”结束!
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm_Main.Button24Click(Sender: TObject);
var lppe: TProcessEntry32;
ssHandle: THandle;
AppFound: Boolean;
begin
Memo.Lines.Clear;
ssHandle := CreateToolHelp32SnapShot(TH32CS_SNAPALL, 0);
AppFound := Process32First(sshandle, lppe);
while AppFound do
begin
//其中lppe.szExefile就是程序名**********************************************
Memo.Lines.Add(ExtractFileName(lppe.szExeFile));
AppFound := Process32Next(ssHandle, lppe);
end;
end;
//==============================================================================
//强制终止某应用程序运行********************************************************
//==============================================================================
procedure AppForceExit(const AppName: string);
var lppe: TProcessEntry32;
ssHandle: THandle;
AppFound: Boolean;
Wnd: HWND;
begin
ssHandle := CreateToolHelp32SnapShot(TH32CS_SNAPALL, 0);
AppFound := Process32First(sshandle, lppe);
while AppFound do
begin
//其中lppe.szExefile就是程序名**********************************************
if UpperCase(ExtractFileName(lppe.szExeFile))=UpperCase(AppName) then
begin
Wnd := OpenProcess(PROCESS_ALL_ACCESS, true, lppe.th32ProcessID);
TerminateProcess(Wnd, 0);
end;
AppFound := Process32Next(ssHandle, lppe);
end;
end;
怎么用啊
如何在上面的memo中选择一条
然后通过一个button结束啊
我试了好长时间
请指点,谢谢