blog.jj5.net (2003 to 2005)

IMessageFilter

Tue Mar 16 02:56:00 UTC+1100 2004

Categories:

I stumbled across this code this evening. I haven't seen the this IMessageFilter interface before, but on the weekend I was fooling around with writing my own message pump for a 'server thread', and I thought it would be cool if I could try and work some magic to integrate it as a .NET component. The thing is, if I fire up my message loop on a thread that is running a windows message loop I block that loop with my own (that's bad).

I haven't meditated deeply on it, but I think it would be cool to write a server component that could be either a stand-alone message pump, or bolt on to the windows UI thread message pump. The goal would be to have a consistent interface for posting messages to a 'local server' that would be handled synchronously in a thread safe manner from any thread in your application. So, if you ended up running a concrete server on a windows UI thread, this IMessageFilter interface seems like you could go some of the way to getting your message pump with out having to implement your own on that thread, but at the same time, if your not on a windows application thread, then you can still provide (and use) the same interface..

I'll think about this some more in my next life, when I have some time.

John.


Copyright © 2003-2005 John Elliot