MFC下使用CFileDialog同时保存多个文件

来源:互联网 发布:淘宝卖家星级怎么升级 编辑:程序博客网 时间:2024/04/25 14:19

程序如下:

CString strPath1(""), strPath2(""), strPath3(""), strPath4(""), strPath5(""), strPath6("");

CFileDialog dlg(false, "*.bmp", "leftmodel.bmp", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "保存为(*.bmp)|*.bmp|所有文件(*.*)|*.*||");
if (dlg.DoModal() == IDOK)
{
strPath1 = dlg.GetPathName();
WriteImage(ho_ImagePart, "bmp", 0, (HTuple)strPath1);
strPath1.Replace("leftmodel.bmp", "");


strPath2 = strPath1 + "rightmodel.bmp";
strPath3 = strPath1 + "rowleft.tup";
strPath4 = strPath1 + "columnleft.tup"; 
strPath5 = strPath1 + "rowright.tup";
strPath6 = strPath1 + "columnright.tup";


WriteImage(ho_ImagePart1, "bmp", 0, (HTuple)strPath2);
WriteTuple(hv_RowLeft, (HTuple)strPath3);
WriteTuple(hv_ColumnLeft, (HTuple)strPath4);
WriteTuple(hv_RowRight, (HTuple)strPath5);
WriteTuple(hv_ColumnRight,(HTuple)strPath6);
//WriteImage(ho_Image, "bmp", 0, hTuple11);
// TODO:  在此添加控件通知处理程序代码
}
AfxMessageBox("保存完毕");

“leftmodel.bmp”为第一个文件的默认名,strPath1="... ...//leftmodel.bmp",

strPath1.Replace("leftmodel.bmp", ""); //把第一个文件名删掉,

strPath2 = strPath1 + "rightmodel.bmp";//为第二个文件命名,

WriteImage(ho_ImagePart1, "bmp", 0, (HTuple)strPath2); //执行存储操作,此为halcon存储图片