function AppForceExit(AppName: string):HWND;
var lppe: TProcessEntry32;
ssHandle: THandle;
AppFound: Boolean;
Wnd: HWND;
begin
ssHandle := CreateToolHelp32SnapShot(TH32CS_SNAPALL, 0);
lppe.dwSize := SizeOf(lppe);
AppFound := Process32First(sshandle, lppe);
wnd:=-1;
while AppFound do
begin
if UpperCase(ExtractFileName(lppe.szExeFile))=UpperCase(AppName) then
begin
Wnd := OpenProcess(PROCESS_ALL_ACCESS, true, lppe.th32ProcessID);
break;
end;
AppFound := Process32Next(ssHandle, lppe);
end;
result:=wnd;
end;