ObjectARX, AutoCAD. Среда программирования библиотеки C++



Добавьте Код, чтобы Поддержать Новый Объект COM ATL - часть 3


acedAlert("Failed to lock the document!");

return Adesk::kFalse;

}

AcDbDatabase* pDb = pDoc->database();

es = pDb->getBlockTable(pBlockTable, AcDb::kForRead);

if (es != Acad::eOk) {

acedAlert("Failed to get block table!");

return Adesk::kFalse;

}

AcDbBlockTableRecord *pBlockRec;

es = pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRec,

AcDb::kForWrite);

if (es != Acad::eOk) {

acedAlert("Failed to get block table record!");

pBlockTable->close();

return Adesk::kFalse;

}

es = pBlockRec->appendAcDbEntity(pEntity);

if (es != Acad::eOk) {

acedAlert("Failed to append entity!");

pBlockTable->close();

pBlockRec->close();

delete pEntity;

return Adesk::kFalse;

}

pBlockRec->close();

pBlockTable->close();

acDocManager->unlockDocument(pDoc);

return Adesk::kTrue;

}

STDMETHODIMP CAsdkDcContent::Initialize(VARIANT varBrowser)

{

m_pBrowser = (IAcDcContentBrowser*)varBrowser.punkVal;

m_pBrowser->AddRef();

return S_OK;

}

STDMETHODIMP CAsdkDcContent::SetImageLists()

{

return S_OK;

}

STDMETHODIMP CAsdkDcContent::NavigatorNodeExpanding(

VARIANT varhNode,

BSTR bstrFullPath)

{

return S_OK;

}

STDMETHODIMP CAsdkDcContent::NavigatorNodeCollapsing(

VARIANT varhNode,

BSTR bstrFullPath)

{

return S_OK;

}

STDMETHODIMP CAsdkDcContent::NavigatorNodeClick(

VARIANT varhNode,

BSTR bstrFullPath)

{

return S_OK;

}

STDMETHODIMP CAsdkDcContent::NavigatorMouseUp(

VARIANT varhNode,

BSTR bstrFullPath,

VARIANT varX,

VARIANT varY)

{

return S_OK;

}

CString CAsdkDcContent::OpenAndReadTextFile(DWORD& length)

{

CFile fileText;

fileText.Open(m_strSelectedItemText, CFile::modeRead);

length = fileText.GetLength();

char *strBuff = new char[length];

fileText.Read(strBuff, length);

fileText.Close();

CString cstrBuff(strBuff);

delete strBuff;

cstrBuff.SetAt(length, ’\0’);

cstrBuff.FreeExtra();

return cstrBuff;

}




Содержание  Назад  Вперед