|
Question : Keyboard input in Dialog box MFC
|
|
I don't ask too many questions, but this has been a problem for a while, and as you know M****S*** has inefficient information.
So please be as simple as possible when answering this, i am not looking for terribly comlex, pointers going crazy thing. Just a simple answer.
HERE GOES:
I have a MFC dialog box.
I have a listbox. member name m_list1;
I have a list of stuff in a multiselect.
I want to delete a selected bunch of things at a touch of delete.
I have tried using the VK_DELETE.
I have inserted a OnKeyDown(3 param) which I added by the wizard. AND IT DOESN'T go there when a key on the keyboard is pressed. I have put a message box there just to see if it even gets there but it doesn't.
Can anybody suggest a way to solve this problem. with key detect working and with the simplest method thinkable?
Thanks in advance.
|
|
Answer : Keyboard input in Dialog box MFC
|
|
Don't try to trap OnKeyDown(). It will only work if there are no controls. Instead try trapping the PreTranslateMessage - something like this:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYUP){ if(pMsg->wParam==VK_DELETE) MessageBox("RUN"); } return CDialog::PreTranslateMessage(pMsg); }
Hope this helps Thanks pagladasu
|
|
|