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