void CSpinbuttonDlg::OnChangeEdit1() 
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here
char buffer[3];
//memset(buffer,0,3);
UpdateData();
m_edit1.GetLine(0,buffer);
int pos=atoi(buffer);
m_progress1.SetPos(pos);
}
当不把//memset(buffer,0,3)当成注释行时,progress控件就不响应了,插入断点也没用,不知道这是怎么回事。

解决方案 »

  1.   

    m_edit1.GetLine(0,buffer); 
    int pos=atoi(m_edit1); 
      

  2.   

    应该不是memset的问题.
    建议把char buffer[3]数组改大些.
      

  3.   

    CEdit::GetLine
    Call this function to retrieve a line of text from an edit control and places it in lpszBuffer. The copied line does not contain a null-termination character.
      

  4.   

    const int MAX_LENGTH 256; //实际情况修改char buffer[MAX_LENGTH]; 
    UpdateData(); 
    int nLength = m_edit1.GetLine(0,buffer);
    buffer[nLength] = '\0'; 
    int pos=atoi(buffer); 
    m_progress1.SetPos(pos);
      

  5.   

    如果只是通过CEdit获得输入Int型变量,也可以利用DDX建立变量来实现
      

  6.   

    设断点看一下pos的值,还有,如果是UNICODE的工程,最好把char换成TCHAR,把atoi换成__ttoi
      

  7.   

    以前说过,你看看GetLine的注释,尤其是EM_GETLINE的说明。
      

  8.   

    嗯,应该也是在这个消息中响应。还用不用用UpdateDate(),试一下就知道了。高手!!!!!
      

  9.   

    呵呵,是地,我因为这个小实验其他的地方也要用到CEdit变量(有助于操作),当然也可以再添加一个value控件变量。呵呵多谢哈!