#include <stdio.h>
#include <windows.h>
int main()
{
HANDLE hMutex = OpenMutex (MUTEX_ALL_ACCESS, TRUE, "MUTEX_SAMPLE");
if (hMutex != NULL)
{
printf ("Another Process Is Running!/nExit!/n");
return 0;
}
hMutex = CreateMutex (NULL, FALSE, "MUTEX_SAMPLE");
if (hMutex == NULL)
{
printf ("CreateMutex Failded!/n");
return 0;
}
printf ("I'm Running!");
Sleep(100000);
return 0;
}