COM“服务器忙”对话框 [英] COM "Server busy" dialog on MFC

查看:324
本文介绍了COM“服务器忙”对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有MFC应用程序,弹出一个服务器忙dilaog看起来像这样:

I have MFC application that pops up a server busy dilaog that looks just like here: How can I disable the OLE "Server Busy" dialog in a C# app?

此应用程序调用AfxOleInit()。
http://support.microsoft.com/kb/248019 说明我应该do
AfxOleGetMessageFilter() - > SetMessagePendingDelay(nTimeout);
,以避免得到对话框。它还建议我使用OleInitialize而不是AfxOleInit来抑制对话框。

This app calls AfxOleInit(). http://support.microsoft.com/kb/248019 explains that i should do AfxOleGetMessageFilter()->SetMessagePendingDelay(nTimeout); to avoid getting the dialog. It also suggest that i use OleInitialize instead of AfxOleInit to suppress the dialog.

这意味着如果我不调用AfxOleInit(),然后我不会得到服务器忙对话框?
我不能真正测试,因为没有AfxOleInit(),AfxOleGetMessageFilter返回空指针,所以我不能真正设置为1ms,并测试,如果它弹出一个对话框,当它超时。

Does this mean if i don't call AfxOleInit(), then i won't get the server busy dialog? I can't really test because without AfxOleInit(), AfxOleGetMessageFilter returns null pointer so I can't really set it to 1ms and test if it pops up a dialog when it times out.

所以我的问题是,如果我不调用AfxOleInit,那么我会得到服务器忙对话框吗?

So my question is, if i don't call AfxOleInit then would i ever get "server busy" dialog?

>

推荐答案

看来,对 AfxOleInit 的调用与' OleInitialize '内部调用' CoInitialize

Look, the call to AfxOleInit does pretty the same as 'OleInitialize' which internally invokes 'CoInitialize'.

它初始化COM环境,因此您可以使用OLE自动化,丰富的OLE容器,ActiveX控件和e.t.c.但是额外性安装了一个消息过滤器,您可以使用 AfxOleGetMessageFilter()获取消息过滤器。此消息过滤器专用于处理情况,当OLE请求阻止UI太长时。

It initializes the COM environment, so you may then use OLE automation, rich OLE containers, ActiveX controls and e.t.c. But additionality it installs a message filter which you may then acquire with AfxOleGetMessageFilter(). This message filter is dedicate to handle situations, when an OLE request blocks UI for too long.

因此,如果调用 OleInitialize 而不是'AfxOleInit',则不会安装消息过滤器,因此您不会请参阅服务器正忙对话框,AfxOleGetMessageFilter()将指向NULL。

So if you call OleInitialize instead of 'AfxOleInit' no message filter will be installed, and thus you will not see the "Server is busy" dialog and AfxOleGetMessageFilter() will point to NULL.

同样如本文所述,您可以使用

Also as suggested in the article, you may use

AfxOleInit()
....
AfxOleGetMessageFilter()->EnableNotRespondingDialog(FALSE);

可禁用此对话框。

你最好的选择是找到根本的问题。

But your best bet would be to find the underlying problem.

这篇关于COM“服务器忙”对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆