cplusplus

VC文本框输入控制

上一篇 / 下一篇  2011-08-27 09:16:41 / 个人分类:VC

CMyDlg::PreTranslateMessage(MSG* pMsg)
{
 // TODO: Add your specialized code here and/or call the base class
 if(pMsg->hwnd == GetDlgItem(IDC_TESTNUM)->m_hWnd)
 {
  
  if(pMsg->message == WM_CHAR)
  {
   if (!isdigit(pMsg->wParam) && (!iscntrl(pMsg->wParam)) && (pMsg->wParam != 13) && (pMsg->wParam != VK_BACK))
   {
    return TRUE;
   }
   /*
   CString str;
   GetDlgItem(IDC_TESTNUM)->GetWindowText(str);
   if (str.GetLength() >= 11)
   {
    DWORD IsSel = 0;
    IsSel = ((CEdit*)GetDlgItem(IDC_TESTNUM))->GetSel();
    if (LOWORD(IsSel) == HIWORD(IsSel))
    {
     return TRUE;
    }
   }    
  }
  return   CDialog::PreTranslateMessage(pMsg);
 }

 return CDialog::PreTranslateMessage(pMsg);
}


TAG:

 

评分:0

我来说两句

Open Toolbar