原文如下
在网络上进行基于SNMP的通讯的时候,会有延迟,这时候想让指针变成漏斗,采集完成后恢复,请教诸位,有例程最好。
我做出来的总是闪一下就变成指针了,有时候都不闪。
采用VC++6.0开发,基于MDI。大家给出2个解法
1.
AfxGetMainWnd()->BeginWaitCursor();//设置等待光标
....
AfxGetMainWnd()->EndWaitCursor();//结束等待光标
2.
CWaitCursor wait;//Open wait cursorwait.Restore();//Close wait cursor我原来就是采用的第一种方法,但是达不到要求,下面举例描述一下我具体的实现。MDI,在CMainFrm中,有一函数响应Main Menu,将弹出一个模式对话框,显示一些从网络设备采集来的数据.如下:
AfxGetMainWnd()->BeginWaitCursor();//设置等待光标//Sleep(1000);dlg.DoMmodal();AfxGetMainWnd()->EndWaitCursor();//结束等待光标现在的问题在于,在DoMmodal函数show出对话框之后,因为有刷新的动作(此对话框和CView是什么关系?鼠标的属性和CMainFrm,CView...什么关系呢?一直不清楚),鼠标马上就回到了指针形状请问如何解决好呢?

解决方案 »

  1.   

    要RestoreWaitCursor();
    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