捆扰我许久的问题,多文档保存所有图片句柄的问题。(解决了问题的追加200分)
来源:百度知道 编辑:UC知道 时间:2024/05/27 14:30:01
在下面这个函数中我想用Vector来保存我多文档保存打开所有图片的句柄,但是这里只能保存一个句柄,现在我想把所有打开的图片句柄都保存,请问在这个函数中怎么修改呢???
BOOL CDIBDisplayDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
CFile file;
CFileException fe;
if (!file.Open(lpszPathName, CFile::modeRead | CFile::shareDenyWrite, &fe))
{
ReportSaveLoadException(lpszPathName, &fe,FALSE,
AFX_IDP_FAILED_TO_OPEN_DOC);
return FALSE;
}
DeleteContents();
BeginWaitCursor();
if(m_pDibImage != NULL)
{
delete m_pDibImage;
m_pDibImage = NULL;
}
m_pDibImage = new CDibImage;
TRY
{
m_hDIB = m_pDibImage->ReadDIBFile(file);
ImgHandle.push_back(m_hDIB);//保存图片句柄
}
CATCH (CFileException, eLoad)
{
file.Abort();
EndWaitCursor();
ReportSaveLoadException(lpszPathName, eLoad,FALSE,
AFX_IDP_FAILED_TO_OPEN_DOC);
m_hDIB = NULL;
if(m_pD
BOOL CDIBDisplayDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
CFile file;
CFileException fe;
if (!file.Open(lpszPathName, CFile::modeRead | CFile::shareDenyWrite, &fe))
{
ReportSaveLoadException(lpszPathName, &fe,FALSE,
AFX_IDP_FAILED_TO_OPEN_DOC);
return FALSE;
}
DeleteContents();
BeginWaitCursor();
if(m_pDibImage != NULL)
{
delete m_pDibImage;
m_pDibImage = NULL;
}
m_pDibImage = new CDibImage;
TRY
{
m_hDIB = m_pDibImage->ReadDIBFile(file);
ImgHandle.push_back(m_hDIB);//保存图片句柄
}
CATCH (CFileException, eLoad)
{
file.Abort();
EndWaitCursor();
ReportSaveLoadException(lpszPathName, eLoad,FALSE,
AFX_IDP_FAILED_TO_OPEN_DOC);
m_hDIB = NULL;
if(m_pD
自己看着修改,仔细点,细心能解决问题!!
Private Sub Command1_Click()
On Error Resume Next
'连接到AtuoCAD应用程序
Dim acadApp As AcadApplication
Set acadApp = GetObject(, "AtuoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AtuoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub