title: How can I permanently change the color of an item in a ListView?
body: <p>I have create list a listview</p>
  
  <pre><code>list[0]=CreateWindow(WC_LISTVIEW,L"",WS_DLGFRAME|WS_CHILD|WS_VISIBLE|LVS_REPORT|LVS_SINGLESEL,-,-,-,-,hwnd,NULL,hInstance,NULL);
  LVCOLUMN lvcolumn;
  lvcolumn.mask = LVCF_FMT|LVCF_TEXT|LVCF_WIDTH;
  lvcolumn.fmt = LVCFMT_CENTER;
  lvcolumn.pszText = L"a";
  lvcolumn.cx = 100;
  ListView_InsertColumn(list[0],0,&amp;lvcolumn);
  lvcolumn.pszText = L"b";
  ListView_InsertColumn(list[0],1,&amp;lvcolumn);
  lvcolumn.pszText = L"c";
  ListView_InsertColumn(list[0],2,&amp;lvcolumn);
  lvcolumn.pszText = L"d";
  ListView_InsertColumn(list[0],3,&amp;lvcolumn);
  </code></pre>
  
  <p>And I use LPNMLVCUSTOMDRAW to insert color item</p>
  
  <pre><code>case WM_NOTIFY:
      if( ((LPNMHDR)lParam)-&gt;code == NM_CUSTOMDRAW){
          switch( ((LPNMLVCUSTOMDRAW)lParam)-&gt;nmcd.dwDrawStage){
              case CDDS_PREPAINT:
                  return CDRF_NOTIFYITEMDRAW;
                  break;
              case CDDS_ITEMPREPAINT:
              {
                  LPNMLVCUSTOMDRAW customDraw = (LPNMLVCUSTOMDRAW)lParam;
  
                  customDraw-&gt;clrText = getcolor();
                  return CDRF_NEWFONT;
                  break;
              }
              default: return CDRF_DODEFAULT;
          }
      }
      break;
  </code></pre>
  
  <p>getcolor is function response colorref. Each item have it own text color. But when the parent window is hide and show again the item color is change. So how to keep it not change or we have another way to set text color</p>
  
  <p>One more I create an new listview item by this way (in case someone need it)</p>
  
  <pre><code>ListView_InsertItem(hwndlist,&amp;lvitem);
  ListView_SetItemText(hwndlist,i,k,(LPWSTR)strarr[k].c_str());
  </code></pre>