I want not to allow selection on the list control items when I try to select the item using right click and should show the selection if left click on the item.
I tried handling it in NM_RCLICK
event to prevent right click selection as follows:
void CTestDlg::OnNMRClickList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
if((pNMItemActivate->uChanged & LVIF_STATE) &&
(pNMItemActivate->uNewState & LVNI_SELECTED))
{
*pResult = 1;
}
else
{
*pResult = 0;
}
}
Please refer screenshot for more information:
Blue color highlight should not come if I do right click on the item where as that highlight should come only for left click.
But still I am able to select the item if it is right click.
Could anyone please help me to solve this issue.