当前位置:主页>仓库管理软件> 列表

求关闭进程的API函数! 找服装店库存软件

记账软件版1楼: 在一个程序里想用API函数关闭另一个正在运行的程序。谢谢指点!

2楼: procedure KillCommandProcess;
var
ProcessSnapShotHandle: THandle;
ProcessEntry: TProcessEntry32;
ProcessHandle: THandle;
Ret: BOOL;
begin
ProcessSnapShotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if ProcessSnapShotHandle>0 then
begin
ProcessEntry.dwSize:=SizeOf(TProcessEntry32);
Ret:=Process32First(ProcessSnapShotHandle, ProcessEntry);
while Ret do
begin
if ProcessEntry.szExeFile=''EXCEL.EXE'' then //你要关闭的程序 注意:大小写敏感
begin
ProcessHandle:=OpenProcess(PROCESS_TERMINATE, False,
ProcessEntry.th32ProcessID);
if ProcessHandle>0 then
begin
TerminateProcess(ProcessHandle, 0);
CloseHandle(ProcessHandle)
end
end;
Ret:=Process32Next(ProcessSnapShotHandle, ProcessEntry)
end;
CloseHandle(ProcessSnapShotHandle)
end
end; 如服装店库存软件

3楼: 谢谢!我试下!!

4楼: Undeclared identifier:''TProcessEntry32''
怎么解决啊??谢谢!!

5楼: uses
TlHelp32

6楼: 太感谢啦!!!!!!!!!!!!