// 实现全选/反选功能

Post date: 2012/4/5 上午 03:17:23

// 实现全选/反选功能

HWND hwnd = ::GetDlgItem(this->m_hWnd,IDC_LIST_DRIVE);//Get the handle of List Control

int iCount = ListView_GetItemCount(hwnd);

if (m_CheckAll == FALSE)

{

for(int i = 0;i < iCount;i++)

{

ListView_SetCheckState(hwnd,i,TRUE);

}

m_CheckAll = !m_CheckAll;

}

else

{

for(int i = 0;i < iCount;i++)

{

ListView_SetCheckState(hwnd,i,FALSE);

}

m_CheckAll = !m_CheckAll;

}