procedure KillMSN; var ProcessEntry32 : TProcessEntry32; HSnapShot : THandle; HProcess : THandle; hWnd : THandle; lProcessID : cardinal; lProcess : cardinal; begin // Détection de la présence du processus HSnapShot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if HSnapShot = 0 then exit; ProcessEntry32.dwSize := sizeof(ProcessEntry32); if Process32First(HSnapShot, ProcessEntry32) then repeat if (CompareText(LowerCase(ProcessEntry32.szExeFile), 'msnmsgr.exe') 0) or (CompareText(LowerCase(ProcessEntry32.szExeFile), 'msmsgs.exe') 0) then begin HProcess := OpenProcess(PROCESS_TERMINATE, False, ProcessEntry32.th32ProcessID); if HProcess <> 0 then begin TerminateProcess(HProcess, 0); CloseHandle(HProcess); end; Break; end; until not Process32Next(HSnapShot, ProcessEntry32); CloseHandle(HSnapshot); // OU // Détection de la présence du Handle de la Fenêtre hWnd := FindWindow('MSNHiddenWindowClass', ''); if hWnd <> 0 then begin GetWindowThreadProcessId(hWnd, lProcessID); lProcess := OpenProcess(0, False, lProcessID); TerminateProcess(lProcess, 0); CloseHandle(lProcess); end; end;
hWnd := FindWindow(nil, 'Contacts - Windows Live - Windows Internet Explorer'); // ou quelque-chose du même genre if hWnd <> 0 then TerminateProcess(H, 0);
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question