IMessageFilter and WM_DRAWCLIPBOARD
I have a component that should be notified when the WM_DRAWCLIPBOARD event is sent, that indicates the the clipboard's content has changed. When i implement IMessageFilter for the component it gets all kind of messages, but not that event. Overriding a form's WndProc method makes it receive the message, but i want my component to work without having to override the form. Is there any way to make a IMessageFilter implementing component receive the WM_DRAWCLIPBOARD event?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Justus10 reputationPosted Oct 7, 2008, 10:28 AM EDT
AlanRank #669 · 3.6K reputationPosted Oct 7, 2008, 11:29 AM EDT
If the component doesn't have any visual interface, then I don't think it can capture the WM_DRAWCLIPBOARD message.
As I understand it, the message only goes to windows which have been added to the ClipboardViewer chain. Please see this MSDN link for confirmation of this:
http://msdn.microsoft.com/en-us/library/ms649025(VS.85).aspx
The only possible workaround I can think of would be to attach a hidden form to the component.
AlanRank #669 · 3.6K reputationPosted Oct 7, 2008, 7:34 AM EDT
I've been trying to figure out why the WM_DRAWCLIPBOARD message wouldn't be captured when you implement IMessageFilter.
Did you call the SetClipboardViewer() API function on your component's window handle to insert it in the ClipBoardViewer chain?