16,471
社区成员
发帖
与我相关
我的任务
分享
BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
if( pMsg->wParam == VK_RETURN )
{
long nStartChar, nEndChar;
LPTSTR m_szBuf = L"";
int nLen = m_RichEdit.GetWindowTextLength();
nLen = m_RichEdit.GetWindowText(m_szBuf, nLen);
m_RichEdit.SetSel(0, 10);
nStartChar = nLen ;
m_RichEdit.GetSel(nStartChar,nEndChar);// .GetSel(nLen, nEndChar);
CString strTest;
strTest = m_RichEdit.GetSelText();
MessageBox(strTest);
}
}
return CDialog::PreTranslateMessage(pMsg);
}
BOOL CPage_Cmd::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
if( pMsg->wParam == VK_RETURN )
{
nLen = m_edit.GetWindowTextLength();
memset(m_szBuf, 0, SIZE_MAX);
nLen = m_edit.GetWindowText(m_szBuf, SIZE_MAX);
m_edit.SetSel(0, 10);
m_edit.GetSel(nLen, m_edit.nEndChar);
CString strTest;
strTest = m_edit.GetSelText();
}
}
return CDialog::PreTranslateMessage(pMsg);
}