| Mr.Gluck 
								Гость
 | 
								|  | « Ответ #1 : 18-07-2004 12:55 »  |  | 
 
 Да, закрыть calc.exe я смог, а вот outpost.exe - никак. мот кто поможет?
 bool getProcessList( void )
 {
 HANDLE hProcessSnap = NULL;
 HANDLE hProcess;
 
 bool bRet = false;
 PROCESSENTRY32 pe32 = {0};
 
 hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
 
 if( hProcessSnap == INVALID_HANDLE_VALUE )
 return false;
 
 pe32.dwSize = sizeof(PROCESSENTRY32);
 
 if( Process32First( hProcessSnap, &pe32 ) )
 {
 DWORD dwPriorityClass;
 BOOL  bGotModule = FALSE;
 
 do
 {
 HANDLE hProcess;
 
 hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE,
 pe32.th32ProcessID);
 dwPriorityClass = GetPriorityClass( hProcess );
 CloseHandle( hProcess );
 
 if(strcmp(pe32.szExeFile, "outpost.exe")==0)
 {MessageBox( NULL, pe32.szExeFile,"!!!", MB_OK );
 hProcess = OpenProcess (PROCESS_ALL_ACCESS,FALSE,
 pe32.th32ProcessID);
 TerminateProcess(hProcess,0);
 
 }
 }
 while( Process32Next( hProcessSnap, &pe32 ) );
 
 bRet = true;
 }
 else
 bRet = false;
 
 CloseHandle( hProcessSnap );
 
 return bRet;
 }
 |