Skip to main content
gamedev.net
🔒 Locked

Problem with windows message handler...

Started by Challenger17 Jun 2, 2004 at 9:31 AM 0 replies 200+ views
Original Post
Challenger17
Challenger17
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!
----------------------------------------------------------------------------------------------------------------------In history, only steam engine and electromagnetics impelled human beings to make progress......
SiCrane
SiCrane
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.