>When I subclass a control in a dialog box, I'm always careful to un-subclass
>the control again before closing the dialog box (i.e. at EndDialog).
>In Petzold's HEAD.C example (page 263-267), he subclasses a listbox, but
>never restores the old proc before processing WM_DESTROY.
> (a) perfectly ok
> (b) sloppy, but ok
> (c) dangerous/wrong
> (d) other
>My guess is (b). Comments?
I'd say it's (a). Why? What need can you think of to un-subclass it?
Your sub-class procedure should be passing all unwanted messages on to
the previous window procdure, not really interfering with the destruction
of the control. And, after the control has been destroyed, your sub-class
procedure will not get called anymore. There's no danger in leaving the
control sub-classed all the way to the end. Windows doesn't care that a
control doesn't have it's original window procedure when it comes time
to destroy it. It's just a matter of the control responding correctly
to messages sent to it.