the fact that i needed to subclass my edit control just to receive some basic messages was kinda anoying. it through me off for a couple of hours trying to figure out what the heck was going on.

so why is it that some controls need to be subclassed just to receive the messages?

AHHH!!!
Posted on 2002-02-12 22:17:51 by smurf
Well, when you create any window, you need to create a class.
edit controls have the EDIT class. This class is provided so that you can easily create an edit control.

MS thought it wise to create classes that have one message handling procedure. I suppose there are many reasons for this, but I don't know what are. Therefore, your edit control has it's message handling procedure in the dark woods of the windows code (probably the kernel) and you need to subclass it in order to see the messages received by the control.

I guess they could have made you pass an argument that tells the edit control where your message handling procedure is. Then again, they didn't.

I, on the other hand, am not as curious as you so I just accept it as a fact. The reason for that is that MS has brainwashed me. Your wish is my command. :)
Posted on 2002-02-12 23:01:28 by Hel
smurf,

I think Hel has said most of it, every window in the system which includes the ordinary controls has a corresponding message handler to handle its messages. As Hel said, with predefined classes of windows which include the edit control you work with, the window already has a message handling procedure but you don't automatically need to access it.

When you do if you wish to process the messages sent to it, you need to be able to access the message handling procedure in the operating system and this is what a "subclass" procedure is for.

You can think of it as a way to "tap" into the operating system to get at an edit control's messages.

Regards,

hutch@movsd.com
Posted on 2002-02-12 23:23:30 by hutch--