Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sir_Spritely

MS DX Framework message handling query

This topic is 5402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!