取消COM调用word,ppt时显示的正在切换对话框

http://support.microsoft.com/kb/248019/en-us 

  How to prevent the OLE Server Busy dialog box from appearing during a lengthy COM operation

View products that this article applies to.
Article ID : 248019
Last Review : November 21, 2006
Revision : 4.1
This article was previously published under Q248019
Note Microsoft Visual C++ .NET (2002) supports both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code.
 Back to the top
 
SUMMARY
If you call a method on a COM server from an MFC COM client application and if the method takes a long time to process and return back, you won't be able to do anything on the client application and the OLE Server Busy dialog box pops up. This article explains how you can increase the time-out period of the COM call and also shows you how to avoid this dialog box.
 Back to the top
 
MORE INFORMATION
Ensure that the MFC client application is calling AfxOleInit() to initialize COM. This is important, because AfxOleInit() also initializes and registers a COleMessageFilter data member in the CWinApp. Alternatively, you can create your own COleMessageFilter object and register that during the startup.
 
Use
AfxOleGetMessageFilter()->SetMessagePendingDelay(nTimeout);
                           
to set the wait period on outgoing COM calls. If the COM call takes longer than nTimeout milliseconds, then the MFC Client application displays the OLE Server Busy dialog box.
 
Use,
AfxOleGetMessageFilter()->EnableNotRespondingDialog(FALSE);
                           
to disable the Not Responding dialog box, which is displayed if a keyboard or mouse message is pending during an OLE call and the call has timed out.
 
Use
  AfxOleGetMessageFilter()->EnableBusyDialog(FALSE);
                           
to disable the busy dialog box from appearing after the COM call times out.
 
Another way to suppress the server busy dialog box is to use OleInitialize and OleUninitialize instead of AfxOleInit in your application.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值