Step 1
Add OnKeyDown method declaration in .h file of subclass of CView like as:           
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); 
nChar
         Virtual key code of the given key. see Winuser.h
nRepCnt
         Repeat count.
nFlags
         Specifies the scan code, key-transition code, previous key state, and context code.
Step 2
Add ON_WM_KEYDOWN() in BEGIN_MESSAGE_MAP and END_MESSAGE_MAP in .m file of subclass of CView like as:        
- BEGIN_MESSAGE_MAP(CDrawViewView, CView)  
-         ON_WM_KEYDOWN()  
-         END_MESSAGE_MAP()  
Here , CDrawViewView is a subclass of CView.
 
Step 3
Add OnKeyDown event definition in .m file like as:        
- /* Key Down Events */  
- void CDrawViewView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)  
- {  
-       switch (nChar)  
-       {  
-              case VK_DELETE:  
-                    AfxMessageBox(L"Delete Key Pressed");  
-                    break;  
-              default:  
-                    CView::OnKeyDown(nChar, nRepCnt, nFlags);  
-       }  
- }  
In above method , get delete key event and showing message box with text "Delete Key Pressed". And VK_DELETE define in winuser.h.