How do I destroy a toolbar created with new operator?
Do I use the same technique as I would with a modeless dialog box -- call DestroyWindow() and create a PostNCDestroy with a delete this or is a simple delete sufficient?
Printable View
How do I destroy a toolbar created with new operator?
Do I use the same technique as I would with a modeless dialog box -- call DestroyWindow() and create a PostNCDestroy with a delete this or is a simple delete sufficient?
The toolbar will be auto destroyed when its parent is destroyed. since u created the MFC toolbar object with new (on heap) you need to delete it in the parents destructor.
I want to destroy it before the parent is destroyed. The toolbar has a very short lifetime on the order of a minute. It is a fly-out toolbar.
i think both options are ok.
Call Destroywindow () and delete (your toolbar) or in your toolbar derived class's PostNCDestroy () delete this.