COM “Server busy” dialog on MFC

笑着哭i 提交于 2019-12-06 09:33:42

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

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.

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);

to disable this dialog.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!