1. 程式人生 > >對話方塊中按下回車後,焦點自動移動到下一個控制元件

對話方塊中按下回車後,焦點自動移動到下一個控制元件

捕獲回車鍵按下訊息並進行如下處理:

BOOL CxxxDlg::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
	{
		GetNextDlgTabItem(GetFocus())->SetFocus();
		return TRUE;
	}
	
	return CDialog::PreTranslateMessage(pMsg);
}