标签:style class blog code java http
转自:http://blog.csdn.net/mailreboot/article/details/1946866
1 //结束进程 2 function KillTask(ExeFileName: string): Integer; 3 const 4 PROCESS_TERMINATE = $0001; 5 var 6 ContinueLoop: BOOL; 7 FSnapshotHandle: THandle; 8 FProcessEntry32: TProcessEntry32; 9 begin 10 Result := 0; 11 FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 12 FProcessEntry32.dwSize := SizeOf(FProcessEntry32); 13 ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); 14 15 while Integer(ContinueLoop) <> 0 do 16 begin 17 if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = 18 UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = 19 UpperCase(ExeFileName))) then 20 Result := Integer(TerminateProcess( 21 OpenProcess(PROCESS_TERMINATE, 22 BOOL(0), 23 FProcessEntry32.th32ProcessID), 24 0)); 25 ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); 26 end; 27 CloseHandle(FSnapshotHandle); 28 end;
标签:style class blog code java http
原文地址:http://www.cnblogs.com/didiwei/p/3783918.html