BOOL CXEdit::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if( pMsg->message == WM_CHAR ) return TRUE;
if( pMsg->message == WM_KEYDOWN &&
( pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN || pMsg->wParam == VK_RETURN ) )
{
int nextprev = GW_HWNDNEXT;
int firstlast = GW_HWNDFIRST;
if( pMsg->wParam == VK_UP ) {
nextprev = GW_HWNDPREV;
firstlast = GW_HWNDLAST;
}
HWND hWnd = m_hWnd;
while( hWnd ) {
HWND hWndx = hWnd;
if( ( hWnd = ::GetWindow( hWnd,nextprev ) ) == NULL )
hWnd = ::GetWindow( hWndx,firstlast );
long style = ::GetWindowLong( hWnd,GWL_STYLE );
if( ( style & WS_TABSTOP && !( style & WS_DISABLED ) && style & WS_VISIBLE ) || hWnd == m_hWnd )
break;
}
::SetFocus( hWnd );
return TRUE;
}
return CEdit::PreTranslateMessage(pMsg);
}
>> 本文固定链接: http://www.vcgood.com/archives/851