vendredi 8 mai 2015

Refreshing List Control with F5 key press C++

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;
}

Aucun commentaire:

Enregistrer un commentaire