我要在一个editbox控件里定时输出一个字符串,为这个编辑框定义了一个成员变量m_str,我想要的输出格式为:                       the 1th time  (第0秒)
                       the 2nd time  (第1秒)
                       the 3th time  (第2秒)
                       ...............
              以上字符串每一秒输出一行,不能覆盖前次输出的,该怎么做啊。我用UpdateData(),可是每次都是一行,存不下以前的。
              各位大哥大姐帮帮忙啊,明天就要拿给别人了,急死我了。在线等好心人。 

解决方案 »

  1.   

    你把Edit设置成Multilinem_str+="the 3th time  (第2秒)";
    UpdateData(FALSE);
      

  2.   

    1. Edit控件选上多行风格
    2. void ScrollLine(CString strLineText)
    {
        CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
        int nLen = pEdit->GetWindowTextLength ();
        pEdit->SetFocus();
        pEdit->SetSel(nLen, nLen);
        strLineText += "\r\n";
        pEdit->ReplaceSel(strLineText);
    }
      

  3.   

    如Atomictry所说,但还要设置一个Timer吧?然后在WM_TIMER的消息处理函数中调用上面所说的输出函数ScrollLine1. SetTimer(NULL, TIMER_ID, 1000, outputScrollLine);2. void CALLBACK outputScrollLine(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
    {
            static long = 0;
            CString str;
            long++;
            str.Format("the %ld time");
            ScrollLine(str);
    }