I wrote a test mfc project based on dialog, just one main dialog, three check boxes on it. in .h file I define a bool var. BOOL m_fCheck[3]; and a function: afx_msg void OnCheck(); in .cpp file : (1) in constructor: for ( int i = 0; i < 3; i++ ) m_fCheck[i] = FALSE; (2) in DoDataExchange void CTestDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTestDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP for ( int i=0; i<3; i++ ) DDX_Check(pDX, IDC_CHECK1 + i, m_fCheck[i]); } (3) On Message Map ON_CONTROL_RANGE(BN_CLICKED, IDC_CHECK1, IDC_CHECK3, OnCheck) (4) OnCheck() function void CTestDlg::OnCheck() { } ???: When I run this test program in debug mode, I click any check box and has no error. But when I run this program in release mode: A fatal error occured: First-chance exception in ChtVCData.exe: 0xC0000096: Privileged Instruction. I do one test today. I change macro ON_CONTROL_RANGE(BN_CLICKED, IDC_CHECK1, IDC_CHECK3, OnCheck) to : ON_BN_CLICKED(IDC_CHECK1, OnCheck) ON_BN_CLICKED(IDC_CHECK2, OnCheck) ON_BN_CLICKED(IDC_CHECK3, OnCheck) And then I run in debug an release mode, no error found again. Now I can asure that the problem is on the macro ON_CONTROL_RANGE(BN_CLICKED, IDC_CHECK1, IDC_CHECK3, OnCheck) it equals the three macro ON_BN_CLICKED(IDC_CHECK1, OnCheck) ON_BN_CLICKED(IDC_CHECK2, OnCheck) ON_BN_CLICKED(IDC_CHECK3, OnCheck) YES OR NO ?
---------------------------------------- Don't let habit prevent you from trying something new.