We have a program that calls a long-running (SolidWorks) API function. After a while, we get an error dialog saying that "the COM server is busy...". We've done some research and have found that you can control this by using a bit of C++ code similar to:
我们有一个程序可以调用长期运行的(SolidWorks)API函数。过了一会儿,我们得到一个错误对话框,说“COM服务器正忙......”。我们做了一些研究,发现你可以通过使用类似于以下的C ++代码来控制它:
COleMessageFilter *pFilter = AfxOleGetMessageFilter();
if(pFilter)
{
pFilter->SetMessagePendingDelay(60000);
pFilter = NULL;
}
Problem is, we're ignorant on the C++ front and want to use VB.NET. We dug around and it turns out AfxOleGetMessageFilter comes from some MFC library. So my question is: is there some way we can achieve this call from VB.NET w/o getting into MFC? Is AfxOleGetMessageFilter a wrapper around some other WIN32API call that we can just DECLARE and call ourselves? Are there alternatives we should be pursuing?
问题是,我们在C ++方面一无所知,并且想要使用VB.NET。我们挖了一下,结果发现AfxOleGetMessageFilter来自一些MFC库。所以我的问题是:有没有什么方法可以从VB.NET实现这个调用进入MFC? AfxOleGetMessageFilter是一个包装其他WIN32API调用的包装器,我们可以直接DECLARE并调用自己吗?有没有我们应该追求的替代方案?
I have one answer that suggests I implement the .NET IMessageFilter interface, but since that interface has only one seemingly unrelated method I'm still stumped.
我有一个答案表明我实现了.NET IMessageFilter接口,但由于该接口只有一个看似无关的方法,我仍然难倒。
1 个解决方案
#1
You can't reuse COleMessageFilter
from MFC this way.
您不能以这种方式从MFC重用COleMessageFilter。
You have to implement IMessageFilter
in VB.Net
您必须在VB.Net中实现IMessageFilter
#1
You can't reuse COleMessageFilter
from MFC this way.
您不能以这种方式从MFC重用COleMessageFilter。
You have to implement IMessageFilter
in VB.Net
您必须在VB.Net中实现IMessageFilter