BOOL CInstrumentEditPanel::PreTranslateMessage(MSG* pMsg) { TCHAR ClassName[256]; switch (pMsg->message) { case WM_KEYDOWN: switch (pMsg->wParam) { case VK_RETURN: // Return pMsg->wParam = 0; OnKeyReturn(); return TRUE; case VK_ESCAPE: // Esc, close the dialog static_cast<CInstrumentEditDlg*>(GetParent())->DestroyWindow(); return TRUE; case VK_TAB: case VK_DOWN: case VK_UP: case VK_LEFT: case VK_RIGHT: case VK_SPACE: // Do nothing break; default: // Note keys // Make sure the dialog is selected when previewing qFatal("GetClassName support!"); // GetClassName(pMsg->hwnd, ClassName, 256); // if (_tcscmp(ClassName, _T("Edit"))) { // // Remove repeated keys // if ((pMsg->lParam & (1 << 30)) == 0) // PreviewNote((unsigned char)pMsg->wParam); // return TRUE; // } } break; case WM_KEYUP: PreviewRelease((unsigned char)pMsg->wParam); return TRUE; } return CDialog::PreTranslateMessage(pMsg); }
BOOL COutputWindow::PreTranslateMessage(MSG* pMsg) { switch( pMsg->message ) { case WM_KEYDOWN: switch( pMsg->wParam ) { case VK_RETURN: OnKeyReturn(); return TRUE; case VK_ESCAPE: OnKeyEscape(); return TRUE; } break; } if( pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP ) { TranslateMessage( pMsg ); DispatchMessage( pMsg ); return TRUE; } else return CSizingControlBar::PreTranslateMessage(pMsg); }