16,472
社区成员
发帖
与我相关
我的任务
分享
BOOL AutoComplete::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
m_bAutoComplete=true;
int nVirtKey=(int)pMsg->wParam;
if(nVirtKey == 9)
{
CWnd* hwnd = this;
do
{
hwnd = hwnd->GetNextWindow();
}while(hwnd->IsKindOf(RUNTIME_CLASS(CStatic)));
hwnd->GetFocus();//不能成功
//hwnd->SetWindowText("123"); 这句可以成功
}
}
return CComboBox::PreTranslateMessage(pMsg);
}
BOOL AutoComplete::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
m_bAutoComplete=true;
int nVirtKey=(int)pMsg->wParam;
if(nVirtKey==VK_DELETE||nVirtKey==VK_BACK)
m_bAutoComplete=false;
if(nVirtKey == 9)
{
CWnd* hwnd = this;
do
{
hwnd = hwnd->GetNextWindow();
}while(hwnd && hwnd->IsKindOf(RUNTIME_CLASS(CStatic)));
if(hwnd)
{
hwnd->SetFocus();
return TRUE;
}
}
}
return CComboBox::PreTranslateMessage(pMsg);
}