CWaitCursor::Restore

void Restore( );

Remarks

To restore the wait cursor, call this function after performing an operation, such as displaying a message box or dialog box, which might change the wait cursor to another cursor.

It is OK to call Restore even when the wait cursor is currently displayed.

If you need to restore the wait cursor while in a function other than the one in which the CWaitCursor object is declared, you can call CCmdTarget::RestoreWaitCursor.

Examples

// This example illustrates performing an operation 
// which changes the wait cursor. You should call 
// CWaitCursor::Restore to restore the wait 
// cursor after an operation which changes the cursor.

void AnotherLengthyFunction( )
{
   CWaitCursor wait;   // display wait cursor

   // do some lengthy processing

   // The dialog box will normally change the cursor to
   // the standard arrow cursor.
   CSomeDialog dlg;
   dlg.DoModal( );

   // It is necessary to call Restore here in order
   // to change the cursor back to the wait cursor.
   wait.Restore( );

   // do some more lengthy processing

   // destructor automatically removes the wait cursor
}

// If the wait cursor is changed by a function called by
// the function which created the wait cursor, you 
// can call CCmdTarget::RestoreWaitCursor to restore 
// the wait cursor.
void CalledFunction()
{
   CSomeDialog dlg;
   dlg.DoModal();

   // Since CWinApp is derived from CCmdTarget, we can use a 
   // pointer to our application object to make the call to
   // CCmdTarget::RestoreWaitCursor.
   AfxGetApp()->RestoreWaitCursor( );

   // Yet more lengthy processing...
}

CWaitCursor OverviewHierarchy Chart

See Also   CCmdTarget::RestoreWaitCursor