MFC: Creating a class (CWnd?) with a CTreeCtrl and a CToolbar

138 Views Asked by At

I have a CDialog based application that has two side-by-side CTreeCtrl and both trees have nearly identical CToolbars above them. Currently, when the dialog receives a message from one of the toolbars, it passes the message to the appropriate tree. I'd like to create a new class, probably derived from a CWnd, that contains one CTreeCtrl and one CToolbar. This new class would pass messages from its one toolbar to its one tree. It would remove a lot of redundant code (presumably) simplify ongoing development.

My question is, is CWnd the appropriate class for this task (to combine a CTreeCtrl and CToolbar)?

Thanks!

1

There are 1 best solutions below

1
On

Yes, CWnd is the perfect container to encapsulate multiple controls. It was a bit of a challenge to register my class, but after that, the messaging worked great.