AfxOleGetMessageFilter()->SetBusyReply(SERVERCALL_RETRYLATER);
AfxOleGetMessageFilter()->EnableNotRespondingDialog(TRUE);
AfxOleGetMessageFilter()->SetMessagePendingDelay(-1);
注意:在加入上面代码的源文件的顶部包含头文件:#include <afxole.h>
消息过滤器参看MSDN:http://msdn.microsoft.com/zh-cn/library/f87xw65k.aspxMFC Library ReferenceCOleMessageFilter Members
Base Class Members
ConstructionConstructs a COleMessageFilter object. |
Puts the application in the busy state. |
|
Enables and disables the dialog box that appears when a called application is busy. |
|
Enables and disables the dialog box that appears when a called application is not responding. |
|
Terminates the application's busy state. |
|
Registers the message filter with the OLE system DLLs. |
|
Revokes the message filter's registration with the OLE system DLLs. |
|
Determines the busy application's reply to an OLE call. |
|
Determines how long the application waits for a response to an OLE call. |
|
Determines the calling application's reply to a busy application. |
Called by the framework to process messages while an OLE call is in progress. |
Concepts
COleMessageFilter ClassHierarchy Chart如何防止冗长 COM 操作期间出现 OLE 服务器忙对话框,参考:http://support.microsoft.com/kb/248019
支持, 同时托管代码模型由 Microsoft.NET 框架提供也 注意 MicrosoftVisualC++.NET (2002) 支持托管本机 MicrosoftWindows 代码模型。 本文信息仅适用于托管 VisualC++ 代码。概要
如果 COM 服务器上调用方法, 如果方法需要较长时间来处理和返回回, 应用程序从 MFC COM 客户不能 pops 客户应用程序和 OLE 服务器忙 对话框上进行任何设置。 本文解释如何您可增加的 COM 调用超时期限并还说明如何避免出现此对话框。更多信息
确保, MFC 客户端应用程序调用 AfxOleInit() 以初始化 COM。 这是重要, 因为 AfxOleInit() 还初始化并在 CWinApp 注册 COleMessageFilter 数据成员。 或者, 您可创建自己 COleMessageFilter 对象并注册, 在启动过程。 使用
AfxOleGetMessageFilter()->SetMessagePendingDelay(nTimeout);将传出 COM 调用上设置等待时间。 如果 COM 调用时间长于 nTimeout 毫秒, 然后 MFC 客户应用程序显示 OLE 服务器忙 对话框。 使用,
AfxOleGetMessageFilter()->EnableNotRespondingDialog(FALSE);要禁用 未响应 对话框, 显示如果键盘或鼠标消息是挂起期间 OLE 调用和调用已超。 使用
AfxOleGetMessageFilter()->EnableBusyDialog(FALSE);要禁用忙 @ 对话框中显示 COM 调用后超时。 另一种以取消服务器忙对话框中为代替 AfxOleInit 使用 OleInitialize 和 OleUninitialize 应用程序中。
参考
有关详细信息, 请单击下列文章编号以查看 Microsoft 知识库中相应:179692 (http://support.microsoft.com/kb/179692/) HRESULT 是 0x80010005 您尝试 VisualC++ 中某个 COM 服务器上调用方法时发生错误有关附加信息, 请访问以下 Microsoft Developer Network (MSDN) Web 站点:COleMessageFilter 类 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_colemessagefilter.3a3a.colemessagefilter.asp (http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_colemessagefilter.htm)COleMessageFilter::SetRetryReply http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_colemessagefilter.3a3a.colemessagefilter.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_colemessagefilter.3a3a.colemessagefilter.asp)COleMessageFilter 成员 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_colemessagefilter.3a3a.colemessagefilter.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_colemessagefilter.3a3a.colemessagefilter.asp)这篇文章中的信息适用于:
• | Microsoft Foundation Class Library 4.2 当用于 | ||||||||||||
|