Introduction - If you have any usage issues, please Google them yourself
BOOL COnlyOneInstApp::InitInstance()
{
if (!FirstInstance())
return FALSE //已经有实例存在了,退出
//根据主窗口类名和主窗口名判断是否已经有实例存在了
if (pWndPrev = CWnd::FindWindow(_T("#32770"),"OnlyOne"))
{//如果存在就将其激活,并显示出来
pWndChild = pWndPrev->GetLastActivePopup()
//如果是最小化的就还原窗口
if (pWndPrev->IsIconic())
pWndPrev->ShowWindow(SW_RESTORE)
pWndChild->SetForegroundWindow()
return FALSE
}