title: c++ ListView - Cannot insert new items after using ListView_DeleteAllItems
body: <p>I have a ListView control with 4 columns that is initialized in the WM_CREATE proc.</p>
  
  <pre><code>        hListView1 = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, NULL, WS_CHILD|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|LVS_REPORT|LVS_SHOWSELALWAYS, 230, 20, 300, 250, hwnd, (HMENU)ID_EDIT1, GetModuleHandle(NULL), NULL);
          ListView_SetExtendedListViewStyle(hListView1, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
              lvCol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
          lvCol.fmt = LVCFMT_LEFT;
  
          lvCol.iSubItem=0;
          lvCol.cx=30;
          lvCol.pszText="";
          ListView_InsertColumn(hListView1, 0, &amp;lvCol);
  
          lvCol.iSubItem=1;
          lvCol.cx=150;
          lvCol.pszText="Name";
          ListView_InsertColumn(hListView1, 1, &amp;lvCol);
  
          lvCol.iSubItem=2;
          lvCol.cx=50;
          lvCol.pszText="Size";
          ListView_InsertColumn(hListView1, 2, &amp;lvCol);
  
          lvCol.iSubItem=3;
          lvCol.cx=80;
          lvCol.pszText="Modified";
          ListView_InsertColumn(hListView1, 3, &amp;lvCol);
  </code></pre>
  
  <p>Then i have a function that will insert the items (it works fine until i call deleteallitems)</p>
  
  <pre><code>...
  LVITEM lvItem;
  j = 0;
  while(FindNextFile(hFind,&amp;FindFileData)){
  lvItem.iItem = j;
          lvItem.iImage = 1;
          if(FindFileData.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY){
              lvItem.iImage = 0;
          }
          ListView_InsertItem(hListView1, &amp;lvItem);
          ListView_SetItemText(hListView1, j, 1, FindFileData.cFileName);
          ListView_SetItemText(hListView1, j, 2, msg1);
          ListView_SetItemText(hListView1, j, 3, msg2);
          j++;
  }
  </code></pre>
  
  <p>But then whenever i call </p>
  
  <pre><code>ListView_DeleteAllItems(hListView1);
  </code></pre>
  
  <p>if after i call my function that insert items, my listview is cleared (the columns are still there) but no new items are insered.. 
  I heard about indexes that are not cleared but i couldnt figured it out.</p>
  
  <p>Thanks in advance ;-)</p>
  
  <p>Solution : 
  Added </p>
  
  <pre><code>    lvItem.mask = LVIF_IMAGE | LVIF_STATE;
  lvItem.state = 0;
  lvItem.stateMask = 0;
  lvItem.iSubItem = 0;
  </code></pre>