tags:

views:

144

answers:

1

Hi. 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:

  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?

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.

A: 

You can't reuse COleMessageFilter from MFC this way.

You have to implement IMessageFilter in VB.Net

cheers,
</wqw>

wqw
I don't see how IMessageFilter can be used to extend or suspend the timeout, it only implements one method called PreFilterMessage which doesn't seem to do any good. ???
scott8035
Ahh...just realized you provided a link...
scott8035