MS DX Framework message handling query

Started by
0 comments, last by Sir_Spritely 20 years, 1 month ago
So the framework has a WndProc() function which is fine but it also has two MsgProc() functions. One of which is in the Application.cpp file which is passed all messages from the WndProc() function and only deals with key presses before passing remaining messages onto the MsgProc() function in the Framework.cpp file. This function then deals with WM_PAINT and WM_CLOSE and the menu messages amongst many others. Now I am making a bare bones framework of this and have found that I have no need for the Msgproc() function in the Application class and the App runs fine without it. I guess my question is, is the only reason Application class has a Msgproc() function to provide some sort of way to split the messages as there is simply too much for the one function in the Framework class? So in other words this is more for how the code looks rather than how the code performs? ** Edit: I have gone through this again, I think this is what is happening in the framework app in terms of message handling: - The WndProc() is a global function so we create a pointer to the Framework object class so when in the WndProc global function we can make a call to a function of the Framework base class. On this occassion we make a call to Msgproc() now MsgProc() is overridden meaning there is also a Msgproc in the inherited Application. Now it is my belief that this Application class MsgProc() takes precendence on this call occassion because it is the derived Msgproc(). So WndProc() is invoked by Dispatch message() function in the Run() function, WndProc() in turn makes a call to the Msgproc() function of the Framework class object via the g_pd3dApp pointer which is pointing to this (this being the Framework class object). However Application class derived overridden function MsgProc() is called first and messages are passed through it first as it takes precedence as the inherited function. Once messages are passed through this they then hit the Framework class object MsgProc() function as per the line return Framework::MsgProc( etc ) in the Application class MsgProc() function. Here the message WM_PAINT etc are dealt with and this function then, once it is done processing the message(s) returns back to DispatchMessage() who then acknowledges message processing is done and thus the While() loop in Run() function continues. ** JUST NOT SURE ABOUT THE PRECEDENCE THING ALTHOUGH IT MAKES THE MOST SENSE TO ME AT THIS STAGE ** It seems to make sense to me at this point but perhaps thats because my brain is cooking at the moment. Any help with this really appreciated. [edited by - Sir_Spritely on February 28, 2004 10:14:49 AM]
Advertisement
*Bump.

Any help with this appreciated as there are no articles on the web anywhere about this and Microsoft offer no help at all.

This topic is closed to new replies.

Advertisement