title: When an MFC dialog is hidden after DoModal, are its controls destroyed?
body: <p>I've used MFC dialogs before where you do:</p>
  
  <pre><code>EnterNameDlg dlg;
  dlg.DoModal();
  string str = dlg.GetName();
  </code></pre>
  
  <p>However a dialog I have now actually looks at a list-box control in such a method and it's not working. Although the class instance clearly exists after <code>DoModal()</code>, does the actual dialog get destroyed? I noticed calling <code>DoModal()</code> a 2nd time leads to <code>OnInitDialog()</code> also being called again which seems to support this theory, the dialog is recreated from the template rather than simply made visible the 2nd time.</p>