下面的一段代码,为什么当我输入的数据0<m_nPage0<=100时保存的数据是对的,不再这个范围内的保存的数据就变成了65636了呢??请高手帮忙解惑……
CSpinButtonCtrl *Page0=(CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_Page0);
    int m_nPage0=Page0->GetPos();
            theApp.WriteProfileInt("Param","Page00",m_nPage0);

解决方案 »

  1.   

    CSpinButtonCtrl *Page0=(CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_Page0);
    int m_nPage0=Page0->GetPos();
    theApp.WriteProfileInt("Param","Page00",m_nPage0);
      

  2.   

    你Debug一下跟踪m_nPage0的值就知道了,再者,你使用GetPos(),要判断值的合理性.
    CSpinButtonCtrl::GetPos
    The current position in the low-order word. The high-order word is nonzero if an error occurred.
    还有你可以使用CSpinButtonCtrl::SetRange设置有效区域,不符合区域不让输入或者输入后变为一个合理值这都是解决方案.
      

  3.   

    The default range for the spin button has the maximum set to zero (0) and the minimum set to 100.