我无法弄清楚问题出在哪里。当我运行下面的代码时,它返回错误代码 87,我已经验证了所有参数,但我不知道出了什么问题。一些帮助?
BOOL ProcessList() {
bool FoundInList = false;
string CommonProcesses[] = {"System", "explorer.exe", "chrome.exe", "firefox.exe", "iexplore.exe", "svchost.exe", "smss.exe", "crss.exe", "wininit.exe", "steam.exe", "devenv.exe", "thunderbird.exe", "skype.exe", "Skype.exe", "pidgin.exe"};
HANDLE hProcessSnap;
PROCESSENTRY32 pe32;
DWORD dwPriorityClass;
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, NULL );
pe32.dwSize = sizeof( PROCESSENTRY32 );
Process32First( hProcessSnap, &pe32 );
do
{
if( GetLastError() ) {
cout << GetLastError();
system( "pause" );
}
wstring pn( pe32.szExeFile );
string ProcessName( pn.begin(),pn.end() );
for ( int i = 0; i <= 15; i++ ) {
if ( ProcessName == CommonProcesses[i] ) {
FoundInList = true;
}
}
if ( !FoundInList ) {
cout << ProcessName << "\n";
GetProcessInfo( ProcessName, pe32.th32ProcessID );
}
FoundInList = false;
} while( Process32Next( hProcessSnap, &pe32 ) );
CloseHandle( hProcessSnap );
return( TRUE );
}