CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Posts
    123

    Destroy toolbar created with new

    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?

  2. #2
    Join Date
    Jun 2003
    Location
    INDIA
    Posts
    586
    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.

  3. #3
    Join Date
    Apr 1999
    Posts
    123
    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.

  4. #4
    Join Date
    Jun 2003
    Location
    INDIA
    Posts
    586
    i think both options are ok.
    Call Destroywindow () and delete (your toolbar) or in your toolbar derived class's PostNCDestroy () delete this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured