Capturing "Delete button down" from keyboard
-
Hi, Can you please tell me how to capture keyboard button down . i want especially for delete button. This is required for me because i should be able to delete selected item by pressing "Delete" or(And) "Del" button of keyboard. Harsha
Can you use of
WM_KEYDOWN/WM_KEYUP
WhiteSky
-
Can you use of
WM_KEYDOWN/WM_KEYUP
WhiteSky
Hello, can be "PretranslateMessage(MSG* pMsg)" solution for this question? Something like this:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_DELETE)
{
// do something, delete?
}
}
return CDialog::PreTranslateMessage(pMsg);
}regards break;
-
Hello, can be "PretranslateMessage(MSG* pMsg)" solution for this question? Something like this:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_DELETE)
{
// do something, delete?
}
}
return CDialog::PreTranslateMessage(pMsg);
}regards break;
Your answer is Yes;),but you must know one thing about WM_KEY*.if you have a control on your forum then you dont get any WM_KEY* because focus send to it control.Test this sibject with a dialog that first it has controls on itself again it doesnt have any control and see retuslt.
WhiteSky
-
Your answer is Yes;),but you must know one thing about WM_KEY*.if you have a control on your forum then you dont get any WM_KEY* because focus send to it control.Test this sibject with a dialog that first it has controls on itself again it doesnt have any control and see retuslt.
WhiteSky
-
Your answer is Yes;),but you must know one thing about WM_KEY*.if you have a control on your forum then you dont get any WM_KEY* because focus send to it control.Test this sibject with a dialog that first it has controls on itself again it doesnt have any control and see retuslt.
WhiteSky
-
I found this function here: ON_WM_KEYDOWN() to use with: OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) is that maybe te current way to catch key input?
Hi, i used the below function on WM_KEYDOWN() message, but donno why it is not working. It is not even detecting if i press any key. i dont know if ishould add something else. Note:in the function "dummy" i have a messagebox to see if its working. void CKeyboard1Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { //char lsChar; //lsChar=char(nChar); switch(nChar) { case VK_DELETE: dummy(); break; default: CString d1; d1="ur code not worki"; MessageBox(d1); } CDialog::OnKeyDown(nChar, nRepCnt, nFlags); } and function prototype i used is in ".h"file is "afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);" Harsha
-
Hi, i used the below function on WM_KEYDOWN() message, but donno why it is not working. It is not even detecting if i press any key. i dont know if ishould add something else. Note:in the function "dummy" i have a messagebox to see if its working. void CKeyboard1Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { //char lsChar; //lsChar=char(nChar); switch(nChar) { case VK_DELETE: dummy(); break; default: CString d1; d1="ur code not worki"; MessageBox(d1); } CDialog::OnKeyDown(nChar, nRepCnt, nFlags); } and function prototype i used is in ".h"file is "afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);" Harsha
-
Hi, i used the below function on WM_KEYDOWN() message, but donno why it is not working. It is not even detecting if i press any key. i dont know if ishould add something else. Note:in the function "dummy" i have a messagebox to see if its working. void CKeyboard1Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { //char lsChar; //lsChar=char(nChar); switch(nChar) { case VK_DELETE: dummy(); break; default: CString d1; d1="ur code not worki"; MessageBox(d1); } CDialog::OnKeyDown(nChar, nRepCnt, nFlags); } and function prototype i used is in ".h"file is "afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);" Harsha
Do you have any controls on the forum?
WhiteSky
-
Ya .. i have added on_wm_keydown().. its not worki even then. Harsha
-
Hello, can be "PretranslateMessage(MSG* pMsg)" solution for this question? Something like this:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_DELETE)
{
// do something, delete?
}
}
return CDialog::PreTranslateMessage(pMsg);
}regards break;
this code is working.. thanks a lot:) Harsha