다음을 통해 공유


CWinApp::DoWaitCursor

이 멤버 함수를 호출 하 여 구현 하는 프레임 워크에서 CWaitCursor, CCmdTarget::BeginWaitCursor, CCmdTarget::EndWaitCursor, 및 CCmdTarget::RestoreWaitCursor.

virtual void DoWaitCursor(
   int nCode 
);

매개 변수

  • nCode
    이 매개 변수가 1 이면 대기 커서를 표시 합니다.0 인 경우 참조 횟수가 증가 하지 않고 대기 커서 복원 됩니다.1 대기 커서 끝나는 경우.

설명

기본 모래 시계 커서를 구현합니다.DoWaitCursor참조 횟수를 유지합니다.양수 때 모래 시계 커서 표시 됩니다.

일반적으로 호출 하는 동안 DoWaitCursor 직접 대기 커서를 변경 하거나 대기 커서가 표시 되는 동안 추가 작업을 수행 하려면이 멤버 함수를 재정의할 수 있습니다.

대기 커서를 구현 쉽게, 보다 효율적인 방법에 대 한, 사용 CWaitCursor.

예제

// The following example shows how to display the
// hourglass cursor during some lengthy processing
void CMdiView::OnLButtonDown(UINT nFlags, CPoint point)
{
   UNREFERENCED_PARAMETER(nFlags);
   UNREFERENCED_PARAMETER(point);

   AfxGetApp()->DoWaitCursor(1); // 1->>display the hourglass cursor

   // do some lengthy processing
   Sleep(1000);

   AfxGetApp()->DoWaitCursor(-1); // -1->>remove the hourglass cursor
}

// The next example shows DoWaitCursor with parameter 0. It restores
// the hourglass cursor.
void CMdiView::OnMButtonDown(UINT nFlags, CPoint point)
{
   UNREFERENCED_PARAMETER(nFlags);
   UNREFERENCED_PARAMETER(point);

   AfxGetApp()->DoWaitCursor(1); // display the hourglass cursor

   // do some lengthy processing

   // The message box will normally change the cursor to
   // the standard arrow cursor, and leave the cursor in
   // as the standard arrow cursor when the message box is
   // closed.
   AfxMessageBox (_T("DoWaitCursor Sample"));

   // Call DoWaitCursor with parameter 0 to restore
   // the cursor back to the hourglass cursor.
   AfxGetApp()->DoWaitCursor(0);

   // do some more lengthy processing
   Sleep(1000);

   AfxGetApp()->DoWaitCursor(-1); // remove the hourglass cursor
}

요구 사항

헤더: afxwin.h

참고 항목

참조

CWinApp 클래스

계층 구조 차트

CCmdTarget::BeginWaitCursor

CCmdTarget::EndWaitCursor

CCmdTarget::RestoreWaitCursor

CWaitCursor 클래스