I am programming the windows base application using MFC. when I was trying to use ON_CONTROL_RANGE function there is an error message popped up.
Visual Studio was used to build the app.
error
E0171 invalid type conversion
why is this error comes up, give me a hint
Code
#define IDC_USR_MANUAL_TUNING_CH1_CHECK 1134
#define IDC_USR_MANUAL_TUNING_CH7_CHECK 1140
ON_CONTROL_RANGE(BN_CLICKED, IDC_USR_MANUAL_TUNING_CH1_CHECK, IDC_USR_MANUAL_TUNING_CH8_CHECK, OnUsrManualTuningChCheck)
void CMainteManualTuningDialog::OnUsrManualTuningChCheck(int nId)
{
if (FALSE == m_bInitFlag) // Initialization flag TRUE: Initialized / FALSE: Uninitialized
{
return;
}
UpdateData(TRUE);
int nChCnt = nId - IDC_USR_MANUAL_TUNING_CH1_CHECK;
if ((CH1 > nChCnt) || (CH8 < nChCnt))
{
return;
}
// unused
if (FALSE == m_bUseCheck[nChCnt])
{
if (nChCnt == m_rbutCh)
{
MessageBox("While selecting a channel, it cannot be invalidated.");
m_bUseCheck[nChCnt] = TRUE; // invalid
}
else
{
m_butUseCheck[nChCnt].SetWindowText(MSG_IGNORE); // Ignore
m_butChSel[nChCnt].EnableWindow(FALSE); // invalid
g_eTuningStat[nChCnt] = E_TUNING_STAT_NONE; // unused
m_strStatCh[nChCnt] = MSG_NONE; // unused
if (FALSE == m_clp->ZeroSetSend(nChCnt, m_pcTuningData))
{
((CMicroDetectorView*)m_hpView)->PostMessage(WM_USR_ALARM, eAPP_T);
}
}
}
// use
else
{
m_butUseCheck[nChCnt].SetWindowText(MSG_USE); // Use
m_butChSel[nChCnt].EnableWindow(TRUE); // Effectiveness
// Unadjusted the adjustment status
SetStatStill(nChCnt);
}
UpdateData(FALSE);
}
CodePudding user response:
when we use the ON_CONTROL_RANGE(wNotifyCode, id, idLast, memberFxn)
memberFxn Fn has to use UINT variables