Search code examples
c++cwindowswinapiwndproc

How to get the MSG value from inside my WindowProc?


Does the Win32 API provide any means to retrieve the struct MSG value that the WindowProc is currently processing, from inside the proc?

P.S. I can't use notorious global constructs like static, it will surely bite me later on.
If it's relevant, the reason I need this is to pump the messages to other handlers (that I know of only at runtime) for the actual processing, and I don't want to lose any data as long as I can help it.


Solution

  • The first four members of the MSG structure are passed to the window procedure. The remaining members can be retrieved through API calls. You can get the pt value using GetMessagePos and the time value using GetMessageTime.