Sign in to follow this  

subclassing

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

subclasing is just replacing a window proc with another,isn't it? there are some subclassing way: 1.derived a win class (class myButton :CButton) in mfc. 2.use SubclassWindow() 3.directly use SetWindowLong() any other way?

Share this post


Link to post
Share on other sites
Yes, subclassing is just replacing the window proc. It's a little like using virtual functions. When you subclass a window, you only handle a few messages (usually), and then you just call the base window's window proc (Using CallWindowProc(), never call it directly or Bad Things will happen).

The only real way to do it is with SetWindowLong(). MFC provides SubclassWindow() which just wraps that behaviour. If you're using MFC, by all means use SubclassWindow().

Share this post


Link to post
Share on other sites

This topic is 4203 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this