BOOL CCodeDlg::PreTranslateMessage(MSG* pMsg)
{
int ch = (int)pMsg->wParam;
if(WM_KEYDOWN == pMsg->message)
{ if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('x' == ch || 'X' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),WM_CUT,0,0);
else if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('c' == ch || 'C' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),WM_COPY,0,0); else if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('v' == ch || 'V' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),WM_PASTE,0,0);
// 这里有 GetKeyState 居然不行
else if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('a' == ch || 'A' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),EM_SETSEL,0,-1);// // 这里去掉GetKeyState 之后OK 。 这是为什么呢?
// if ( ('a' == ch || 'A' == ch) )
// ::SendMessage(this->GetFocus()->GetSafeHwnd(),EM_SETSEL,0,-1); }
return CDialog::PreTranslateMessage(pMsg);
}
{
int ch = (int)pMsg->wParam;
if(WM_KEYDOWN == pMsg->message)
{ if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('x' == ch || 'X' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),WM_CUT,0,0);
else if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('c' == ch || 'C' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),WM_COPY,0,0); else if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('v' == ch || 'V' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),WM_PASTE,0,0);
// 这里有 GetKeyState 居然不行
else if ( (::GetKeyState(VK_CONTROL) & 0x8000) & ('a' == ch || 'A' == ch) )
::SendMessage(this->GetFocus()->GetSafeHwnd(),EM_SETSEL,0,-1);// // 这里去掉GetKeyState 之后OK 。 这是为什么呢?
// if ( ('a' == ch || 'A' == ch) )
// ::SendMessage(this->GetFocus()->GetSafeHwnd(),EM_SETSEL,0,-1); }
return CDialog::PreTranslateMessage(pMsg);
}
解决方案 »
- ub1.exe 中的 0x777015de 处有未经处理的异常: 0xC0000005: 读取位置 0xfeeefef6 时发生访问冲突
- 在vs2010中添加组件和控件
- C++前辈来指点下
- 0x40000000是什么意思
- 谁能告诉我在那里能够下在bios.h文件!
- 在程序中如何自身复制?
- 如何在extremeprogramming电子小组上订阅newsletter?
- 请教语法问题?
- 我的程序用了SetLayeredWindowAttributes函数,但是编译时总是说函数没有定义。为什么?
- 每次运行都要重新编译运行?
- 销毁非模式对话框???//在对话框的析构函数里执行不行吗???
- 当任务栏在左侧时,GetCursorPos获取的坐标不是屏幕坐标?如何解决?
为什么要用&呢.