19,468
社区成员
发帖
与我相关
我的任务
分享
void CImageProcessorDoc::OnFileSaveAs()
{
LPCTSTR lpszFilter="BMP Files(*.bmp)|*.bmp|任何文件|*.*||";
CFileDialog dlg(FALSE,lpszFilter,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,lpszFilter,NULL);
if(dlg.DoModal()!=IDOK)
return;
CFile file;
CFileException fe;
if (!file.Open(dlg.GetPathName(), CFile::modeCreate | CFile::modeReadWrite | CFile::shareExclusive, &fe))
{
//失败
ReportSaveLoadException(dlg.GetPathName(),&fe,TRUE,AFX_IDP_INVALID_FILENAME);
return;
}
file.SeekToBegin();
file.Write(&bf,sizeof(bf));
file.Write(&bi,sizeof(bi));
if(numquad!=0)
{file.Write(quad,sizeof(RGBQUAD)*numquad);
}
file.WriteHuge(lpbuf,bi.biSizeImage);
file.Close();
}