Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

programming in C++ : problem for accessing block properties

Status
Not open for further replies.

jpg2

Computer
Oct 26, 2003
1
here is a small function to query the name of each block in the current drawing

void CDrvAcad::GetBlockList(CStringList *pList)
{
IAcadBlocksPtr pBlocksCollection = m_acadDoc->GetBlocks();
IAcadBlockPtr pBlock;
_variant_t index;
index.vt = VT_I4;
long count = pBlocksCollection->GetCount();
CString str;

for (int i = 0; i< count; i++)
{
index.lVal = i;
pBlock = pBlocksCollection->Item(index);
str = pBlock->GetName()
}
}

I know that the pBlock is valid, because i can access properties as blockID, blockHandle, ....
but pBlock->GetName() will stop the execution (&quot;access violation&quot;). Another strange thing : if i have 2 Autocad applications running at the same time, it works !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor