C++: Capture Windows Messages from an MFC app without using MFC
Spanish version / Versión en Español Let's say you need your C++ dll to communicate with a third party dll which uses MFC and Windows Messages to send data and notifications. The easiest way out would be to write an MFC application with a dialog which handled those messages. But let's say your C++ dll is at a very low layer and you don't want GUI code there. At least not openly. Well, there is no avoiding the Windows Messages, so we'll be using, at least, the Win32 unmanaged API. So how do we capture Windows Messages without showing a window? Some basic things you should know first: To capture Windows Messages, you must create a window (associated with a HWND) and use its message loop There is one message loop per thread. This implies that the message-handling window must live in the same thread as the message-generating code A window can be created as a Message-Only window , in MSDN jargon. And that's what we'll do Once I learned all of ...