Advertisement Jump to content


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


Another question (windows stuff)

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

Where does the return go from WinProc? Is there a way to let WinProc get at a private variable in one of my classes? Is there an after life? Are crispers chips or crackers? And how do they get the caramel inside the caramel bar??? OneEyeLessThanNone "I CAN''T SEE MY EYES!!!!!!" - Clayton

Share this post

Link to post
Share on other sites
The return value from winproc either goes back to the caller if the message was sent using the SendMessage() function or is used internaly by windows if the message was posted with PostMessage() function.

The SendMessage() function calls WinProc() directly without placing a message into the message queue. The return value from WinProc() becomes the return value from SendMessage().

The PostMessage() function places the message in the message queue. Then you retrieve the message from the message queue using the GetMessage() or PeekMessage() function in your message loop. You then call the DispatchMessage() function and it calls WinProc(). In this case the return value is used by Windows internaly, normaly to indicate that the message was processed.

One way for WinProc to gain access to private variables inside of a class is to make your WinProc a static member of the class in question. The one problem with this approch is that static functions can only access static data in a class since they don't have access to the this pointer. Without the this pointer, the static function doesn't know what class you want to retrieve a value from. Since static functions and varibles are shared across instances of a class, a static function can retrieve static varibles.

as for your other questions...
I will answer them in order.

God I hope so, or life is a waste of time.


They use a carmel stuffer which was invented by the same guy that created the device used for giving a person an enema in the hospital. (Isnt that a lovely picture )

Edited by - bstach on 3/10/00 7:36:47 PM

Share this post

Link to post
Share on other sites
Ok, when I try to make winproc static it gives me all kinds of errors, I''ve tried many different combinations and none work. I have the whole class in one file including the WinProc function. I have a header declaring the class which is included in the class file and the main file.
How should my class declerations, winproc decleration and locatoin of winproc be for this to work?


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!