Skip to main content
gamedev.net
🔒 Locked

subclassing

Started by derek7 Jun 14, 2006 at 5:06 PM 0 replies 250+ views
Original Post
derek7
derek7
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?
Evil Steve
Evil Steve
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().

Topic Locked

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

Sign in to reply to this topic.