title: Bitmap images not showing in CListCtrl report view
body: <p>I'm trying to create a dialog in MFC that contains a CListCtrl to display a list of items with associated images. However, the images are being displayed as blank white squares. They are there, or at least, there is a space where they should be.</p>
  
  <p>I am trying to load the bitmap from a file (although I have also tried loading from a resource ID which has the same effect) and I am storing it in a CImageList. This image list is then given to the CListCtrl. I'm fairly certain that the bitmap is being correctly loaded as I have managed to load the same bitmap successfully elsewhere in my project using the same code.</p>
  
  <p>I'm not sure whether this is important, but this is part of a context menu shell extension and the dialog is raised when the user clicks on one of the items in the explorer context menu. Also, I'm relatively new to MFC so apologies if I've just missed something really obvious.</p>
  
  <p>The following is my code for initialising the CListCtrl in report view with two columns and one item which should have the image in the first column and some text in the second:</p>
  
  <pre><code>// Get reference to list control
  CListCtrl m_list_control = (CListCtrl*)GetDlgItem(IDC_LISTCONTROL);
  
  // Create image list
  CImageList image_list;
  image_list.Create(32, 32, ILC_COLOR4, 0, 3);
  
  HANDLE hBitMap = ::LoadImage(0, L"E:\pathtomybitmap\bitmap1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); 
  CBitmap bitmap; 
  bitmap.Attach((HBITMAP)hBitMap); 
  
  image_list.Add(&amp;bitmap, RGB(255, 0, 255));
  
  // Add the image list to the list control 
  // (LVSIL_NORMAL didn't seem to show anything at all)
  m_list_control-&gt;SetImageList(&amp;image_list, LVSIL_SMALL);
  
  
  // Add columns
  LVCOLUMN column;
  column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_IMAGE;
  column.fmt = LVCFMT_LEFT | LVCFMT_IMAGE;
  column.cx = 100;
  column.pszText = (LPWSTR)&amp;L"Image";
  column.iImage = 0;
  
  m_list_control-&gt;InsertColumn(0, &amp;column);
  
  m_list_control-&gt;InsertColumn(1, _T("Text"), LVCFMT_LEFT, 100);
  
  
  int index = m_list_control-&gt;InsertItem(0, _T(""), 0);
  m_list_control-&gt;SetItemText(0, 1, _T("My text"));
  </code></pre>
  
  <p>Any idea what I'm doing wrong?</p>