본문 바로가기
C++

MFC ListControl Func

by 사무실 꿀벌 2020. 6. 23.
반응형

How to MFC ListControl Add CheckBox
void ListView_SetExtendedListViewStyle(HWND hwndLV, DWORD dwExStyle)
DWORD SetExtendedStyle(DWORD dwNewStyle)
LVS_EX_CHECKBOXES

BOOL ListView_GetCheckState(HWND hwndLV, UINT index)

void Cxxx::OnLvnItemchangedxxx(NMHDR *pNMHDR, LRESULT *pResult)
{
 LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
    // LVS_EX_CHECKBOXES
    // State image 1 is the unchecked box, and state image 2 is the checked box.
    // Setting the state image to zero removes the check box.
   UINT nOldCheck = pNMLV->uOldState & LVIS_STATEIMAGEMASK;
   UINT nNewCheck = pNMLV->uNewState & LVIS_STATEIMAGEMASK;
   if(nOldCheck && nNewCheck && nOldCheck != nNewCheck)
   {
      BOOL bCheck = m_lstXXX.GetCheck(pNMLV->iItem);
       //TODO: 
    }
}

반응형

'C++' 카테고리의 다른 글

다이얼로그 숨김  (0) 2020.07.16
CFile Function Write()  (0) 2020.06.24
How to MFC ListControl Header Size Auto Setting  (0) 2020.06.02
CString Path 경로 가져오기  (0) 2020.06.02
MFC 실행파일 경로 찾기  (0) 2020.06.02