Try this:
const MSG* pm = GetCurrentMessage( );
int id = LOWORD( pm->wParam );
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
Before I begin, let me tell you that Microsoft Q & A forms was totally Sh**, if you compare to MSDN forms. It's the third time a re-begin this message because Code Block window give some trouble when it's time to edit.
Ok..
What I try to done it's plug EN_CHANGE to the same Function. Unfortunately this message map have no input parameter like OnCtlColor, that you can call pWnd->GetDlgCtrlID(). Does it Possible to get IDC (#1)?
BEGIN_MESSAGE_MAP(CTopSleeveDlg, CDialogEx)
//{{AFX_MSG_MAP(CTopSleeveDlg)
ON_EN_CHANGE(IDC_EDTCENTER2CENTER, &CTopSleeveDlg::SameFunction)
ON_EN_CHANGE(IDC_EDTSLEEVETHICK, &CTopSleeveDlg::SameFunction)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
int CTopSleeveDlg::OnEditChange(int Index)
{
UpdateData(TRUE);
double Value;
long hr = m_piLogic->GetValueFromExpression(m_Param[Index].Expression, &Value, m_Param[Index].UnitType);
m_Param[Index].IsValid = SUCCEEDED(hr) ? 1 : 0;
return m_Param[Index].IsValid;
}
void CTopSleeveDlg::SameFunction()
{
#1 Get IDC of current Control;
for (long i = 0; i < m_NbElem; i++)
{
if (CtrlID == m_Param[i].IDD)
{
OnEditChange(i);
break;
}
}
}
/*** To Remove
void CTopSleeveDlg::OnChangeEdtcenter2center()
{
OnEditChange(0);
}
void CTopSleeveDlg::OnChangeEdtsleevethick()
{
OnEditChange(1);
}
*/
Try this:
const MSG* pm = GetCurrentMessage( );
int id = LOWORD( pm->wParam );
You can use the ON_CONTROL_RANGE message map macro. You must manually insert it into the message map. The range of control id's must be contiguous. For example, in a dialog that has two edit controls IDC_EDIT1 (1000) and IDC_EDIT2 (1001) -
ON_CONTROL_RANGE(EN_CHANGE, IDC_EDIT1, IDC_EDIT2, &CMFCRangeTestDlg::OnChange)
Header declaration -
void OnChange(UINT nId);
Implementation -
void CMFCRangeTestDlg::OnChange(UINT nId)
{
TRACE(_T("Received EN_CHANGE from control id %d\n"), nId);
}