title: winapi listview check item c++
body: <p>I use minGW32 compiler.
  I created a ListView with checkbox something like this:</p>
  
  <pre><code>HWND hListView = CreateWindowExW(0, WC_LISTVIEWW, L"",
      WS_VISIBLE | WS_CHILD | WS_TABSTOP | LVS_REPORT | LVS_EDITLABELS,
      10,10,500,500, hwnd, (HMENU)ID_LISTVIEW, GetModuleHandle(NULL), NULL);
      SendMessage(hListView, WM_SETFONT, (WPARAM) font, TRUE);
  
  ListView_SetExtendedListViewStyle(hListView, LVS_EX_CHECKBOXES |  LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_GRIDLINES/*LVSCW_AUTOSIZE_USEHEADER*/);
  
  lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH  | LVCF_FMT;
  lvc.fmt  = LVCFMT_LEFT;
  </code></pre>
  
  <p>And I would like to check when any checkbox is checked. for example. If I check any checkbox show me a messagebox:</p>
  
  <pre><code>I use this WM_NOTIFY:
  case WM_NOTIFY:
   {
    switch (LOWORD(wParam))
    {
     case ID_LISTVIEW:
     {
     switch (((LPNMHDR) lParam)-&gt;code)
     {
      case LVN_ITEMCHANGED :
      MessageBoxW( NULL, (LPCWSTR)lpMsgBuf, L"Error", MB_OK | MB_ICONERROR ); 
      }
      break; 
     }
    break;
    }
    break;
   }
   break;
  </code></pre>
  
  <p>But this alwas happened. When I click an empty area of the ListView or when just click any item. But I would like to run the messagebox ONLY when the checkbox is changed.</p>