我写了一个基于对话框的程序。在程序中我需要经常改变鼠标的形状为漏斗状。于是我使用了BeginWaitCursor和EndWaitCursor来改变和结束鼠标的漏斗状。但是不知道为什么,有的时候可以,有的时候不起作用。我用setcursor(AfxGetApp()->LoadStardardCursor())也是这样,有时可以,有时不可以。请哪位有经验的指点一下?
解决方案 »
- MSDN脚本错误,如何解决
- 需要采用缓冲方式(比如满100条输出)将日志信息输出,如何使用SendMessage/PostMessage和GetMessage函数
- 一个简单的问题,请帮忙,谢谢
- CInternetSession' : undeclared identifier是为何?
- 请教一个循环的问题
- 麻烦的问题,高手请进
- 如何识别字符串中的汉字,并插入汉字标识符
- 昨天偶然用了一下 Visual Studio Express 2013,就石化了
- 我马上就要毕业了,想找一份程序员的工作,希望大家帮帮我,我的条件.....
- MFC 框内画线
- 关于__stdcall形式函数得导出问题
- 单文档浏览器问题
// of displaying the hourglass cursor during some lengthy
// processing of a command handler implemented in some
// CCmdTarget-derived class, such as a document or view.
void CMyView::OnSomeCommand()
{
BeginWaitCursor(); // display the hourglass cursor
// do some lengthy processing
EndWaitCursor(); // remove the hourglass cursor
}// The next example illustrates RestoreWaitCursor.
void CMyView::OnSomeCommand()
{
BeginWaitCursor(); // display the hourglass cursor
// do some lengthy processing
// The dialog box will normally change the cursor to
// the standard arrow cursor, and leave the cursor in
// as the standard arrow cursor when the dialog box is
// closed.
CMyDialog dlg;
dlg.DoModal();// It is necessary to call RestoreWaitCursor here in order
// to change the cursor back to the hourglass cursor.
RestoreWaitCursor();
// do some more lengthy processing
EndWaitCursor(); // remove the hourglass cursor
}// In the above example, the dialog was clearly invoked between
// the pair of calls to BeginWaitCursor and EndWaitCursor.
// Sometimes it may not be clear whether the dialog is invoked
// in between a pair of calls to BeginWaitCursor and EndWaitCursor.
// It is permissable to call RestoreWaitCursor, even if
// BeginWaitCursor was not previously called. This case is
// illustrated below, where CMyView::AnotherFunction does not
// need to know whether it was called in the context of an
// hourglass cursor.
void CMyView::AnotherFunction()
{
// some processing ...
CMyDialog dlg;
dlg.DoModal();
RestoreWaitCursor();// some more processing ...
}// If the dialog is invoked from a member function of
// some non-CCmdTarget, then you can call CWinApp::DoWaitCursor
// with a 0 parameter value to restore the hourglass cursor.
void CMyObject::AnotherFunction()
{
CMyDialog dlg;
dlg.DoModal();
AfxGetApp()->DoWaitCursor(0); // same as CCmdTarget::RestoreWaitCursor
}