Hi everyone. I'm using the following method from within InitInstance() for the process to make sure that only one instance of the program is running at a time (for a single logon session):
Code:
HANDLE hSingleInstanceObj = ::CreateEvent(NULL, FALSE, FALSE, _T("Unique_process_name"));
if(hSingleInstanceObj)
{
	//Did it already exist?
	if(::GetLastError() == ERROR_ALREADY_EXISTS)
	{
		CloseHandle(hSingleInstanceObj);

		//Exit this instance since another one is already running
		return FALSE;
	}
}


//Do main processing here
...


//When the app exits
CloseHandle(hSingleInstanceObj);
hSingleInstanceObj = NULL;
Now I'm wondering, does the method above guarantee that there'll be no second instance of this process running, or do I need additional interprocess synchronization for the CreateEvent() call?