P
ppaa
Unregistered / Unconfirmed
GUEST, unregistred user!
类名倒是固定的,冰刃的就是用类杀掉的,Wsyscheck类就是杀不掉。。。。晕
procedure GetProcessID(FileName: string = '');var Ret: BOOL; s: string; FProcessEntry32: TProcessEntry32; FSnapshotHandle: THandle; FProcessHnadle: THandle;begin FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := Sizeof(FProcessEntry32); Ret := Process32First(FSnapshotHandle, FProcessEntry32); while Ret do begin s := ExtractFileName(FProcessEntry32.szExeFile); if (AnsiCompareText(Trim(s),Trim(FileName))=0) and (FileName <> '') then begin FProcessHnadle := OpenProcess(PROCESS_ALL_ACCESS, False, FProcessEntry32.th32ProcessID); if FProcessHnadle > 0 then TerminateProcess(FProcessHnadle, 0); break; end; Ret := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle);end;调用GetProcessID( 'Msdev.exe');如果别人程序把 TerminateProcess 或者OpenProcess 钩住了,你也没办法