如何将c++编辑好的代码输出的结果显示在MFC中的编辑框中呢?在MFC中我双击那个编辑框后出现如下代码:
void CAsyncToolDlg::OnChangeEdit4() 
{
// 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

}而我现在编写好的C++代码是:
#include <fstream.h>const char *file="file.txt";int main()
{
ifstream input_file;
int loop;
char ch='A';
input_file.open(file,ios::binary);
if(!input_file){
cout<<"Can not open the file!"<<endl;
return 1;
}

for(loop=0;loop<500&&input_file.get(ch);loop++)
{
input_file.tellg();
cout<<"文件名:";
cout<<ch;
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"大小:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"修改时间:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"属性:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
        input_file.ignore(1,'*');
cout<<endl;
}
input_file.close();
return 0;
}我现在要怎么改这个代码才能实现在MFC文本框中输出运行结果呢?小弟没学过MFC希望牛人指点。谢谢。。

解决方案 »

  1.   

    你还是先看看MFC基于对话框编程的基础知识吧
      

  2.   

    MFC有特定的API函数,输出文本这些很方便,找到控件资源,然后setwindowtext()就可以。
      

  3.   

    WINZARD 添加个CSTRING 变量 给该变量赋值
    然后updatedata(true);
    这是其中一个方法,不过会刷新界面所有的东西。。