Try this:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
TCHAR szMutex[] = "Global\\{6EBCEE90-C5EB-4891-A818-D7ED72F3AE3A}";
int main(int argc, char **argv)
{
// Try to open the mutex.
//HANDLE hMutex = OpenMutex(MUTEX_ALL_ACCESS, 0, szMutex);
HANDLE hMutex = OpenMutex(SYNCHRONIZE, 0, szMutex);
if (hMutex) {
printf("Already running %Xh %d\n", (int)hMutex, GetLastError());
return 0;
}
hMutex = CreateMutex(0, 0, szMutex);
// ***************
printf("First run %Xh\npress enter to stop \n", (int)hMutex);
getchar();
// ***************
ReleaseMutex(hMutex);
CloseHandle(hMutex);
return 0;
}