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?
AlanPosted Oct 7, 2008, 3:29 PM
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.
JustusPosted Oct 7, 2008, 2:28 PM
AlanPosted Oct 7, 2008, 11:34 AM
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?