// activate an application with a window with a specific class name
BOOL CMyApp::FirstInstance()
{
CWnd *pWndPrev, *pWndChild;
// Determine if a window with the class name exists...
pWndPrev = CWnd::FindWindow(_T("MyNewClass"), NULL);
if (NULL != pWndPrev)
{
// If so, does it have any popups?
pWndChild = pWndPrev->GetLastActivePopup();
// If iconic, restore the main window
if (pWndPrev->IsIconic())
pWndPrev->ShowWindow(SW_RESTORE);
// Bring the main window or its popup to the foreground
pWndChild->SetForegroundWindow();
// and you are done activating the other application
return FALSE;
}
return TRUE;
}
from :
FindWindowExA function (winuser.h) - Win32 apps | Microsoft Docs
'VisualStudio.C++.C# > 코딩팁,함수활용,단편' 카테고리의 다른 글
std::function<R(Args...)>::target (0) | 2020.09.08 |
---|---|
Fixed width integer types C99표준. stdint.h 에 정의 있음. uint8_t, uint64_t 등. (0) | 2020.09.07 |
MFC.대화상자. x버튼 그레이처리 (1) | 2020.08.31 |
WM_COPYDATA . OnCopyData . CWnd * pWnd . WPARAM (0) | 2020.08.31 |
Critical Section (크리티컬 섹션) (0) | 2020.05.13 |
댓글