title: Changing the color of a row in list control in mfc on double click
body: <p>I have a list control <code>CListCtrl</code>  named  <code>m_listCtrl</code> which displays <code>ID</code> , <code>Firstname</code> and <code>Lastname</code> when the dialogbox is created. In the code below I handle a <code>double click</code> by getting the <code>position</code> of the item clicked and changing the value of the first column of that row.</p>
  
  <pre><code>//This is in the message map and IDC_LISTNAMES is the list control
  ON_NOTIFY(NM_DBLCLK, IDC_LISTNAMES,  OnDoubleClick)
  
  
  void CSqlMfcTestDlg::OnDoubleClick(NMHDR* pNMHDR, LRESULT* pResult) 
  {
  
    POSITION pos = m_listCtrl.GetFirstSelectedItemPosition();
    if (pos == NULL)
    {
      TRACE(_T("No items were selected!\n"));
    }
    else
    {
      while (pos)
      {
          int nItem = m_listCtrl.GetNextSelectedItem(pos);
  
          itemClicked = nItem;
          CString idString = m_listCtrl.GetItemText(nItem, 0);
          CString textString = m_listCtrl.GetItemText(nItem, 1);
          MessageBox(L"Item Clicked is : " + textString);
          m_listCtrl.SetItemText(nItem,0, idString+L"(Clicked)");
  
  
      }
    }
  
  }
  </code></pre>
  
  <p>instead of  <code>m_listCtrl.SetItemText(nItem,0, idString+L"(Clicked)");</code> I would like to add a statement to change the color of that row.</p>