tppe.dwsize:=sizeof(tppe);
tt:=createtoolhelp32snapshot(TH32CS_SNAPTHREAD,0);
if thread32first(tt,tppe) then
repeat
if tppe.th32OwnerProcessID=pid then
begin
if tppe.th32threadid<>ThI then begin
//hThread:=OpenThread(PROCESS_TERMINATE, False, tppe.th32threadid);
TerminateThread(hThread,0);
listbox1.items.add(inttostr(tppe.th32threadid));
end;
end;
until not thread32next(tt,tppe);
closehandle(tt);
tt:=createtoolhelp32snapshot(TH32CS_SNAPTHREAD,0);
if thread32first(tt,tppe) then
repeat
if tppe.th32OwnerProcessID=pid then
begin
if tppe.th32threadid<>ThI then begin
//hThread:=OpenThread(PROCESS_TERMINATE, False, tppe.th32threadid);
TerminateThread(hThread,0);
listbox1.items.add(inttostr(tppe.th32threadid));
end;
end;
until not thread32next(tt,tppe);
closehandle(tt);
function OpenThread(dwDesiredAccess: DWORD; bInheritHandle:
BOOL; dwProcessId: DWORD): THandle; external
kernel32 name 'OpenThread';