|
2007 提取标题栏属性问题:
我使用函数ebPaGetHeaderBlock 获取方式如下:
rtn = ebPaGetHeaderBlock(&SysEntBase,&pBlock,str);
if(rtn != RT_NORMAL){
AfxMessageBox("ebPaGetHeaderBlock失败");
return RT_FAILED;
}
AfxMessageBox(str);
最后弹出来的对话框竟然是图框的名称,而不是标题栏的名称,感觉非常奇怪。
采用另外一种方式获取,但是中途CAXA2007会出现内存不可读,然后终止程序。获取的方式如下:
CBlock *pTitleBlock = NULL;
pTitleBlock = GetFrameBlock("*HEADER", &SysEntBase);//*HEADER
if (NULL==pTitleBlock){
AfxMessageBox("GetFrameBlock 获取失败");
return RT_FAILED;
}
AfxMessageBox(pTitleBlock->name);
CStringArray attrName;
CStringArray attrValue;
ebPaGetHeaderAttArray(pTitleBlock,attrName,attrValue);
str.Format("%d",attrValue.GetSize());
AfxMessageBox(str);
for(int attrCount = 0;attrCount<attrValue.GetSize();attrCount++){
strTemp.Format(attrName.GetAt(attrCount)+"="+attrValue.GetAt(attrCount));
AfxMessageBox(strTemp);
}
另外,我尝试使用2011来提取属性,同样也失败了,
2011采用CRX方式来获取,但是缺少方法:
程序如下:
CRxDbBlockTable *pBlockTable;
crxdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, CRxDb::kForRead);
CRxDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(CRXDB_MODEL_SPACE, pBlockTableRecord,CRxDb::kForRead);
pBlockTable->close();
//创建块表记录遍历器,用遍历器遍历实体
CRxDbBlockTableRecordIterator *pBlockIterator;
CRxDbBlockReference *pAttRef;
pBlockTableRecord->newIterator(pBlockIterator);
for (;!pBlockIterator->done();pBlockIterator->step()){
CRxDbEntity *pEntity;
pBlockIterator->getEntity(pEntity, CRxDb::kForRead);
//crxutPrintf(TEXT("\n%s"),pEntity->desc()->name());
pAttRef = CRxDbBlockReference::cast(pEntity);
if (pAttRef != NULL) {
CRxDbObjectIterator *pBlkRefAttItr=pAttRef->attributeIterator();
for (pBlkRefAttItr->start(); !pBlkRefAttItr->done();pBlkRefAttItr->step())
{
CRxDbObjectId attObjId;
attObjId = pBlkRefAttItr->objectId();
CRxDbAttribute *pAtt = NULL;
CDraft::ErrorStatus es = crxdbOpenObject(pAtt, attObjId, CRxDb::kForRead);
if (es != CDraft::eOk){
crxutPrintf(TEXT("\nFailed to open attribute"));
delete pBlkRefAttItr;
continue;
}
crxutPrintf(TEXT("\n%s"),pAtt->tag());
pAtt->close();
}
}
但是没有attributeIterator方法,系统里面的头文件注释掉了,我去掉头文件的注释,但是链接的时候会出错。
希望各位知道的兄弟,能够帮帮我,谢谢。
|
|