I have a List Control that shows a list of my database users. I also have a function that refreshes the list control (currently it is mapped to a "Refresh" button).
When the user presses the "F5" key, I want to call my refresh function.
I have found an event LVN_KEYDOWN (Indicates that a key has been pressed). After some research, I have found that the virtual keycode for "F5" is VK_F5
. I am having trouble putting the two together, how can I check to see (in my event) that the "F5" key was the one that was pressed? I have tried several things similar to the code below:
void ListOption::OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
// TODO: Add your control notification handler code here
if(pLVKeyDow == (LPNMLVKEYDOWN)VK_F5)
callRefreshFunction();
*pResult = 0;
}
The wVKey
member contains the virtual key code:
if(pLVKeyDow->wVKey == VK_F5) {
callRefreshFunction();
*rResult = 1;
}
According to comments on MSDN you have to set the return value to 1 if you handle the message.