How to subclass multiple controls using a single ATL window object

  atl, subclass, winapi, windows

Let’s say you’ve created a subclass for a control (perhaps as a CContainedWindow, or as just a CWindowImpl-derived class), and you’ve got a bunch of identical controls within a dialog that you’d like to subclass accordingly.

Is there an elegant way to subclass all of those identical dialog controls using a single instance of your ATL window class? If not, is there some other ATL class or function that would fit this purpose? Or is it necessary to create a separate class instance for each control, and call the subclass method on it? Thanks for any input.

Source: Windows Questions

LEAVE A COMMENT