Reply

OleMessageFilter & IMessageFilter

What is the difference between OleMessageFilter.VB & IMessageFilter.VB? Which file should I use in my programs and why?
3 REPLIES

Re: OleMessageFilter & IMessageFilter

[ Edited ]

This topic is covered in the Handling 'Application is Busy' and 'Call was Rejected By Callee' errors SDK article. The IOleMessageFilter interface mentioned is actually IMessageFilter on MSDN. The IMessageFilter description on MSDN states:

 

"Provides COM servers and applications with the ability to selectively handle incoming and outgoing COM messages while waiting for responses from synchronous calls. Filtering messages helps to ensure that calls are handled in a manner that improves performance and avoids deadlocks. COM messages can be synchronous, asynchronous, or input-synchronized; the majority of interface calls are synchronous."

 

That said, all that is required is that you have some class that implements IMessageFilter. The OleMessageFilter.VB referenced in the SDK documentation is simply a default example implementation that you can use as-is or roll your own implementation.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: OleMessageFilter & IMessageFilter

But I have seen examples where both files have been used. That's causing confusion.

Re: OleMessageFilter & IMessageFilter

IMessageFilter is nothing more than an interface. A contract. It does nothing on it's own but define what an implementing class must implement. I author the Solid Edge Samples on GitHub and no where in my samples will you see a direct reference to the IMessageFilter interface. If you look at my OleMessageFilter.cs implmentation, you will see IMessageFilter references. That is the only class that uses that interface and all other code uses the OleMessageFilter class.

Jason Newell
Applications Architect
www.jasonnewell.net