我简单做了一下,基本实现你要的功能,事件响应代码在下面
得到路径之后,然后对文件进行文件内容的读取,读取到一个缓冲区内,然后 用 setwindowtext函数将 内容显示在 下面的空间上即可
void ctest2dlg::onbutton1()
{
// todo: add your control notification handler code here
cstring strpath;//用来保存文件路径
char strbuff[0xffff];//用来保存文件内容
cfile file;//文件类对象
cfiledialog dlg(true); //文件对话框类对象
if(dlg.domodal()==idok)
{
strpath=dlg.getpathname();//获取路径
}
getdlgitem(idc_edit_path)->setwindowtext(strpath);//设置路径文本
file.open(strpath,cfile::moderead);//打开文件
int filesize=file.getlength();
file.read(strbuff,filesize);//读取
strbuff[filesize]='\0';
getdlgitem(idc_edit_txt)->setwindowtext(strbuff);
}