添加扩展数据(字符串)
void SetXdata(AcDbEntity *pEnt, CString AppName, CString Names)
{
TCHAR appname ;
strcpy(appname,AppName);
acdbRegApp(appname);
struct resbuf *rbb;
rbb = pEnt->xData(appname);
TCHAR names ;
strcpy(names,Names);
if (rbb ==NULL)
{
rbb = acutBuildList(1001,AppName,1000,(ACHAR*)names,0);
}
else
{
struct resbuf *pItr;
bool bHasString = false;
for (pItr = rbb;pItr !=NULL;pItr = pItr->rbnext)
{
if (pItr->restype ==1000)
{
bHasString = true;
if (pItr->resval.rstring)
{
delete pItr->resval.rstring;
pItr->resval.rstring = NULL;
}
pItr->resval.rstring = _tcsdup(names);
break;
}
}
}
pEnt->setXData(rbb);
acutRelRb(rbb);
}
页:
[1]