BOOL CCsdn9View::PreTranslateMessage(MSG* pMsg)
{
// if(WM_RBUTTONDOWN == pMsg->message)
// return true;
/* if(WM_KEYDOWN == pMsg->message)
{
int nState = GetKeyState(VK_CONTROL);
if(nState < 0)
{
int ch = (int) pMsg->wParam ;
if('x' == ch || 'X' == ch)
::SendMessage(GetDlgItem(IDC_EDIT1)->GetSafeHwnd(),WM_CUT,ID_EDIT_CUT,0);
if('C' == ch || 'c' == ch)
::SendMessage(GetDlgItem(IDC_EDIT1)->GetSafeHwnd(),WM_COPY,ID_EDIT_CUT,0);
if('v' == ch || 'V' == ch)
::SendMessage(GetDlgItem(IDC_EDIT1)->GetSafeHwnd(),WM_PASTE,ID_EDIT_CUT,0);
}
}
return CFormView::PreTranslateMessage(pMsg);*/
UINT nKeyCode = pMsg->wParam; // virtual key code of the key pressed
if (pMsg->message == WM_KEYDOWN)
{
if ( (nKeyCode == _T('C') || nKeyCode == _T('X')
|| nKeyCode == _T('V')) &&
(::GetKeyState(VK_CONTROL) & 0x8000) )
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return(TRUE);
}
}
return CFormView::PreTranslateMessage(pMsg);
}
注释掉的代码是别一种实现方法
没有下面的一种简洁
如果在CEdit中实现Ctrl+V、Ctrl+C、Ctrl+X的功能
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:项目报错一
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Python剪贴板的Ctrl+c与Ctrl+v
Python剪贴板的Ctrl+c与Ctrl+v
python 开发语言 .net 字符串 -
js屏蔽鼠标右键菜单&键盘ctrl+c,ctrl+v等
js屏蔽鼠标右键菜单以及屏蔽键盘ctrl+c,ctrl+v,ctrl+a,ctrl+s,ctrl+p
js javascript html css jquery