二重起動防止


	// InitInstance の初めの方で
	m_hAppMutex = ::CreateMutex(NULL, TRUE, _T("UNIQUE_PROGRAM_NAME"));
	if (!m_hAppMutex)
		return FALSE;
	if (ERROR_ALREADY_EXISTS == ::GetLastError())
	{
		CString csWork;
		csWork.LoadString(IDS_APPTITLE);
		HWND hPrevWnd = ::FindWindow(NULL, (LPCTSTR)csWork);
		if (hPrevWnd)
			::SetForegroundWindow(hPrevWnd);
		return FALSE;
	}

VC覚書きページ...