Good Morning,

I have created a SDI with the Wizard in VS2008 using the MFC libraries and it is preloaded with the 'visual studio' dockable windows. What I am looking to do replace the dockable windows that were provided with my own. And it is going rather well, almost.

I added a formview dialog resource with the controls (widgets) I want on the screen, and used the class wizard to add the CFormView class to the resource. Now I have created a CDockablePane to hold onto the form in the main frame. After bumbling around for a little bit I got the pane attached and drawing the form in the main frame. The problem comes when I exit program. I get a error window that says that there is corruption in the heap.

I have narrowed it down the creation of the form. I have the form declared as a member of the dockablepane, and isn't dynamically allocated, so it is created on the heap.

I am creating it with:
// here is teh test. Create the view in the pane.
TRACE0("Failed to create secondary window\n");
return -1;

If I comment this out, then the heap error goes away.

I know that I am missing something REALLY basic here but I can't for the life of me find it and any help would be appreciated.

A little background on me. I was, until very recently, a Linux programmer that used QT for the vast majority of his software development. I am REALLY new to VS2008, and microsoft programming as a whole and it is very weird and confusing for me.