title: Creating Modeless Property Sheet Using Property Page Array MFC C++
body: <p>I am creating a Property Sheet derived from CMFCPropertySheet it is created from the mainframe when a initial editor page is called. My question is when an additional page is called I would like a new tab created for it. Each page that is invoked will be derived by the same class but the max number of pages is unknown so it needs to be defined as</p>
  
  <pre><code>    CEditorPage *m_editorpage[];
  </code></pre>
  
  <p>but the compiler complains that its using a zero sized array. 
  In the destructor I delete the pages created in a for loop from 0 to number of pages in sheet.
  in post destroy I delete the this pointer.
  Program crashes and stops at</p>
  
  <pre><code>    delete this;
  </code></pre>
  
  <p>If I don't use an array it doesn't crash.  But because I am using the same class page in each property page and I don't know how many there will be I need to use a zero sized array.
  Either way I am getting a memory leak.</p>
  
  <p>How can I create a zero sized CMFCPropertyPage based array in the Property Sheet so I can add additional pages during run time and perform proper cleanup when Property Sheet is closed. I either get a crash or memory leak in every method I have tried.</p>