title: create a control programmatically using MFC
body: <p>I just wonder how to do it. 
  I write :</p>
  
  <pre><code>CEdit m_wndEdit;
  </code></pre>
  
  <p>and in the button event handler (dialog app),
  I write :</p>
  
  <pre><code>m_wndEdit.Create(//with params);
  </code></pre>
  
  <p>but I still don't see the control appear in the UI.</p>
  
  <p>I actually wrote this in the button handler :</p>
  
  <pre><code>CWnd* pWnd = GetDlgItem(IDC_LIST1);
  CRect rect;
  
  pWnd-&gt;GetClientRect(&amp;rect);
  
  //pWnd-&gt;CalcWindowRect(rect,CWnd::adjustBorder);
  
  wnd_Edit.Create(ES_MULTILINE | ES_NOHIDESEL | ES_READONLY,rect,this,105);
  
  wnd_Edit.ShowWindow(SW_SHOW);
  
  this-&gt;Invalidate();
  </code></pre>
  
  <p><code>id 105</code> doesn't exist. (I used it in the <code>Create</code> member function of <code>CEdit</code>). I just put it in there. isn't it supposed to be the id you want to give to the new control ? Should it already exist ?</p>