lovelyzhao 发表于 2005-11-23 16:31:00

请教:关于添加扩展数据

<P>void Adddlg::OnAddBUTTON() <BR>{<BR>&nbsp;// TODO: Add your control notification handler code here<BR>&nbsp;ads_name ent;<BR>&nbsp;<BR>&nbsp;int Adddlg::init_reg_app();<BR>&nbsp;&nbsp;&nbsp; if(acdbEntLast(ent)!=RTNORM) return;&nbsp;//获取最后的实体赋给ent.</P>
<P>&nbsp;Adddlg::init_reg_app();</P>
<P>&nbsp;struct resbuf head1,*eb1=NULL,*eb2=NULL;<BR>&nbsp;struct resbuf ex0,ex1,ex2;<BR>&nbsp;<BR>&nbsp;eb1=acdbEntGetX(ent,&amp;appname1);<BR>&nbsp;<BR>&nbsp;head1.restype=-3;<BR>&nbsp;head1.rbnext=&amp;ex0;</P>
<P>&nbsp;if(eb1==NULL) <BR>&nbsp;{<BR>&nbsp;&nbsp;ads_printf("\n在获取实体扩展数据时出错,请重试!");<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</P>
<P>&nbsp;ex0.restype=1001;&nbsp; //应用程序名<BR>&nbsp;ex0.resval.rstring=local_appname;<BR>&nbsp;ex0.rbnext=&amp;ex1;</P>
<P>&nbsp;ex1.restype=1000;&nbsp; //实体标记,这里为outlet<BR>&nbsp;ex1.resval.rstring="This is flag";<BR>&nbsp;ex1.rbnext=&amp;ex2;<BR>&nbsp;<BR>&nbsp;ex2.restype=1000;&nbsp; //名字<BR>&nbsp;ex2.resval.rstring="zhao feng jiao";<BR>&nbsp;ex2.rbnext=NULL;&nbsp; </P>
<P>&nbsp;eb2=eb1;<BR>&nbsp;while (eb2-&gt;rbnext!=NULL)<BR>&nbsp;&nbsp;eb2=eb2-&gt;rbnext;<BR>&nbsp;eb2-&gt;rbnext=&amp;head1;<BR>&nbsp;if(acdbEntMod(eb1)!=RTNORM)<BR>&nbsp;{ <BR>&nbsp;&nbsp;acutPrintf("\n在附加扩展数据时,系统出错.");<BR>&nbsp;&nbsp;return;<BR>&nbsp;} <BR>&nbsp;while (eb2-&gt;rbnext!=NULL) eb2=eb2-&gt;rbnext;<BR>&nbsp;while (eb1-&gt;rbnext!=NULL) eb1=eb1-&gt;rbnext;<BR>&nbsp;return;<BR>}</P>
<P>int Adddlg::init_reg_app()<BR>{<BR>&nbsp;struct resbuf *rbp; </P>
<P>&nbsp;strcpy(local_appname,"TEST"); <BR>&nbsp;<BR>&nbsp;if ((rbp = acdbTblSearch("APPID", local_appname, 0)) == NULL) <BR>&nbsp;{ <BR>&nbsp;&nbsp;if (acdbRegApp(local_appname) != RTNORM) <BR>&nbsp;&nbsp;{ <BR>&nbsp;&nbsp;&nbsp;acutPrintf("\n不能为&lt;%s&gt;注册XDATA.", local_appname); <BR>&nbsp;&nbsp;&nbsp;return RTERROR; <BR>&nbsp;&nbsp;} <BR>&nbsp;} <BR>&nbsp;else <BR>&nbsp;&nbsp;acutRelRb(rbp); <BR>&nbsp;appname1.resval.rstring=local_appname; </P>
<P>&nbsp;return RTNORM;<BR>}</P>

<P>这里那里有问题,可编译成功,但在cad里运行时,就有操作地址的错误,搞得cad死翘翘啦。高人请指点一二。谢谢!</P>
页: [1]
查看完整版本: 请教:关于添加扩展数据