다음을 통해 공유


CWnd::FindWindow

최상위 반환 CWnd 해당 창 클래스에서 지정 lpszClassName 는 창 이름 또는 제목에서 지정 하 고 lpszWindowName.

static CWnd* PASCAL FindWindow( 
   LPCTSTR lpszClassName, 
   LPCTSTR lpszWindowName  
);

매개 변수

  • lpszClassName
    창 클래스 이름을 지정 하는 null로 끝나는 문자열을 가리키는 (은 WNDCLASS 구조). 경우 lpClassName 는 NULL, 모든 클래스 이름과 일치 합니다.

  • lpszWindowName
    창 이름 (윈도우의 제목)를 지정 하는 null로 끝나는 문자열을 가리킵니다. 경우 lpWindowName 는 NULL, 모든 창 이름이 일치 합니다.

반환 값

지정 된 클래스 이름 및 창 이름 가진 창을 식별 합니다. 이 NULL 이러한 창이 없는 경우.

CWnd* 임시 수 있으며 나중에 사용 하려고 저장 해서는 안 됩니다.

설명

이 함수는 자식 창을 검색 하지 않습니다.

예제

// 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;
}

요구 사항

헤더: afxwin.h

참고 항목

참조

CWnd 클래스

계층 구조 차트

FindWindow