NO

Author Topic: ListView control : how to detect Ctrl-A shortcut to select all the items  (Read 3377 times)

Jean-Pierre Leroy

  • Guest
I have a listview control and I would like to detect the Ctrl-A shortcut to select all the items.

Any ideas how to do that ?

Thanks,
Jean-Pierre

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2123
check WM_NOTIFY code
Code: [Select]
void OnNotify(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
if (wParam == 4001) { // Listview Id
if (((NMHDR*)lParam)->code == LVN_KEYDOWN) {
if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_A) {
SHORT nState = GetKeyState(VK_CONTROL);
if (nState & 0x80) {
SetWindowText(hWnd, "Ctrl-A");
}
}
}
}
}
May the source be with you

Jean-Pierre Leroy

  • Guest
Thank you very much.

It works perfectly.

Regards,
Jean-Pierre