Edit Control的Enter响应函数
Edit Control的Enter响应函数
-
在dialog中添加edit control ,选择“Multi_Line mode”
-
MFC Class Wizard中添加Virtual Function ,将PreTranslateMessage函数重载,并在重载函数中添加如下代码
-
一个例子如下:
if ( WM_KEYFIRST == WM_KEYDOWN ) // <= pMsg->message && pMsg->message <= WM_KEYLAST
if (pMsg->wParam==VK_RETURN )
{
HWND hWnd=::GetFocus();
int m_nID=::GetDlgCtrlID(hWnd);
GX_STATUS status;
if ( m_nID == 1023IDC_EDIT_ExplosureTime )
{
UpdateData(TRUE);
if (m_bLfDeviceOpen)
status = m_LfCamera.SetFloat( GX_FLOAT_EXPOSURE_TIME, m_fExplosureTime);
if (m_bLfDeviceOpen)
status = m_RiCamera.SetFloat( GX_FLOAT_EXPOSURE_TIME, m_fExplosureTime);
m_sldShutter.SetPos(( int )m_fExplosureTime );
UpdateData(FALSE);
}
}
return CDialog::PreTranslateMessage(pMsg);