title: Select nodes in a Tree Control (MFC)
body: <p>I created a tree control in  VC++, but I cant select the child nodes. Any suggestions?</p>
  
  <pre><code>m_pTree-&gt;Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
                   TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT |
                   TVS_SINGLEEXPAND | TVS_SHOWSELALWAYS | 
           TVS_TRACKSELECT,CRect(10, 10, 200, 240), this, 0x1221);
  
  hTree=m_pTree-&gt;InsertItem(_T("SoftWare Production") , TVI_ROOT);
  hCompany=m_pTree-&gt;InsertItem(_T("Microsoft"),hTree);
  m_pTree-&gt;InsertItem(_T("Office") , hCompany);
  m_pTree-&gt;InsertItem(_T("Visual Studio") , hCompany);
  m_pTree-&gt;InsertItem(_T("Servers") ,hCompany , TVI_LAST);
  
  m_pTree-&gt;Expand(hCompany, TVE_EXPAND);
  
  hCompany=m_pTree-&gt;InsertItem(_T("Linux"),hTree);
  m_pTree-&gt;InsertItem(_T("Open Office") , hCompany);
  m_pTree-&gt;InsertItem(_T("QMail") , hCompany);
  m_pTree-&gt;InsertItem(_T("Apache") ,hCompany,TVI_LAST);
  
  
  
  m_pTree-&gt;Expand(hCompany, TVE_EXPAND);
  </code></pre>