I need to intercept the Paste message that is being sent to my CHtmlView object. According to Spy++, it’s being sent as a WM_COMMAND message – but also according to Spy++, the message isn’t being sent to the CHtmlView object, but rather to the Internet Explorer_Server (or IWebBrowser2) object that it wraps. The WM_COMMAND message in question is not seen in any other parent objects (I’ve found this by observation and via Spy++).
How do I intercept this (or even, say, a Select All) message? I’ve watched AfxCallWndProc for the correct WM_COMMAND message, and it doesn’t show up there.
To intercept a message (ex: WM_COMMAND) you need to subclass the window (in your case Internet Explorer_Server) by calling:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb773183(v=vs.85).aspx#set_windowsubclass
After that your own windows procedure takes controls first and you can decide what to do with the message.