void Adddlg::OnAddBUTTON() { // TODO: Add your control notification handler code here ads_name ent; int Adddlg::init_reg_app(); if(acdbEntLast(ent)!=RTNORM) return; //获取最后的实体赋给ent.
Adddlg::init_reg_app();
struct resbuf head1,*eb1=NULL,*eb2=NULL; struct resbuf ex0,ex1,ex2; eb1=acdbEntGetX(ent,&appname1); head1.restype=-3; head1.rbnext=&ex0;
if(eb1==NULL) { ads_printf("\n在获取实体扩展数据时出错,请重试!"); return; }
ex0.restype=1001; //应用程序名 ex0.resval.rstring=local_appname; ex0.rbnext=&ex1;
ex1.restype=1000; //实体标记,这里为outlet ex1.resval.rstring="This is flag"; ex1.rbnext=&ex2; ex2.restype=1000; //名字 ex2.resval.rstring="zhao feng jiao"; ex2.rbnext=NULL;
eb2=eb1; while (eb2->rbnext!=NULL) eb2=eb2->rbnext; eb2->rbnext=&head1; if(acdbEntMod(eb1)!=RTNORM) { acutPrintf("\n在附加扩展数据时,系统出错."); return; } while (eb2->rbnext!=NULL) eb2=eb2->rbnext; while (eb1->rbnext!=NULL) eb1=eb1->rbnext; return; }
int Adddlg::init_reg_app() { struct resbuf *rbp;
strcpy(local_appname,"TEST"); if ((rbp = acdbTblSearch("APPID", local_appname, 0)) == NULL) { if (acdbRegApp(local_appname) != RTNORM) { acutPrintf("\n不能为<%s>注册XDATA.", local_appname); return RTERROR; } } else acutRelRb(rbp); appname1.resval.rstring=local_appname;
return RTNORM; }
这里那里有问题,可编译成功,但在cad里运行时,就有操作地址的错误,搞得cad死翘翘啦。高人请指点一二。谢谢! |