you can try something like this in InitInstance() :

m_mutex = CreateMutex( NULL, TRUE, _T("MyApp"));
if( GetLastError() == ERROR_ALREADY_EXISTS) {
::MessageBox( NULL, _T("An instance is already running."),
_T("ERROR!"), MB_OK | MB_ICONEXCLAMATION );
return TRUE;
}