Advertisement Jump to content


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


Problem with windows message handler...

This topic is 5344 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

ok here''s the problem. i wrote a class of my own named "CEngine". it has a static member function "static LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )" which is used as the message handler for my app''s main window. ok, now this window has a menu, and i want to change some Render State parameters through this menu when the app is running. the problem is, MsgProc() must be declared as a static member in my class, and those Render State parameters are also part of my class, they can''t be accessed by MsgProc() coz it''s static!!! so, how can i change some Render State parameters through window menu? btw i don''t want MsgProc() to be separated from my class. thx!

Share this post

Link to post
Share on other sites
The usual solution to this problem is to use SetWindowLong() and GetWindowLong() with GWL_USERDATA to store a pointer to the object that can be used to access member variables. An example of how you might do this is in Oluseyi''s article on window wrappers here on gamedev.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!