EDIT2: For those who think this is a duplicate, no this isn't. This was made in different context, knowing if a proccess is running and i did not knew i needed to convert till here 'martin' gives me the answer :p
EDIT: Answer was found! https://stackoverflow.com/a/12637971/4908011
I'm using Windows 7 with Visual Studio 2013 Deluxe. I can't seem to find any way to make a compatible x32 console application finding a process.
I need to know if a process is running, e.g. RobloxPlayerBeta.exe
.
I keep getting the error:
WCHAR* incompatible with const char*
At 'strcmp(procEntry.szExeFile, name)'
The code I use:
bool ProcessRunning(const char* name)
{
HANDLE SnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (SnapShot == INVALID_HANDLE_VALUE)
return false;
PROCESSENTRY32 procEntry;
procEntry.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(SnapShot, &procEntry))
return false;
do
{
if (strcmp(procEntry.szExeFile, name) == 0)
return true;
} while (Process32Next(SnapShot, &procEntry));
return false;
}