有时程序执行某个过程很耗时,为了提示用户程序处于忙碌状态,可以将鼠标设置为转圈的忙碌状态:
{
CWaitCursor wait; // display wait cursor. 设置为忙碌模式
// do some lengthy processing
Sleep(1000);
AfxMessageBox(_T("Process Complete")); //This changes the cursor.
wait.Restore(); //Restore the Wait cursor. 继续变回忙碌模式
Sleep(1000);
// wait.~CWaitCursor(); //主动消除忙碌模式
}// destructor automatically removes the wait cursor. 出作用域后忙碌模式消除
本文介绍了如何在程序执行耗时任务时,通过CWaitCursor实现鼠标转圈的忙碌状态提示,以增强用户交互体验。作者详细展示了设置和恢复忙碌模式的过程,并在适当位置使用MessageBox通知用户任务完成。
561

被折叠的 条评论
为什么被折叠?



