Another question (windows stuff)
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
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.
yes.
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
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.
yes.
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
Thanks, that clears things up a bit.
Umm, yes does not ancwer if it is cracker or chip, could you be more specific?
OneEyeLessThanNone - "I CAN''T FEEL MY BRAIN!!!!" - Bill
Umm, yes does not ancwer if it is cracker or chip, could you be more specific?
OneEyeLessThanNone - "I CAN''T FEEL MY BRAIN!!!!" - Bill
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?
OneEyeLessThanNone
How should my class declerations, winproc decleration and locatoin of winproc be for this to work?
OneEyeLessThanNone
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement