fanny_6 发表于 2005-7-13 17:06:00

关于控件注册

<P>Sub textadd()</P>
<P>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim objDbx As AxDbDocument<BR>&nbsp;&nbsp;&nbsp; Dim objStyle(0) As Object<BR>&nbsp;&nbsp;&nbsp; If Left(Version, 2) = "15" Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Call AutoRegFile("C:\Program Files\AutoCAD 2002\axdb15.tlb")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set objDbx = CreateObject("ObjectDBX.AxDbDocument.1")<BR>&nbsp;&nbsp;&nbsp; ElseIf Left(Version, 2) = "16" Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set objDbx = CreateObject("ObjectDBX.AxDbDocument.16")<BR>&nbsp;&nbsp;&nbsp; End If</P>
<P>&nbsp;&nbsp;&nbsp;'。。。。。。。。。。。。。。。。。。。。。。。。。。。 </P>
<P>&nbsp;&nbsp; End Sub</P>

<P>Function AutoRegFile(FileName As String)<BR>Dim reged As Boolean<BR>Dim RegFile1 As String<BR>Dim RegFile2 As String<BR>Dim BeReg As String<BR>Dim RetVal<BR>BeReg = Dir(FileName)<BR>If BeReg &lt;&gt; "" Then<BR>&nbsp; RegFile1 = Environ("windir") &amp; "\system\regsvr32.exe "<BR>&nbsp; RegFile2 = Environ("windir") &amp; "\system32\regsvr32.exe "<BR>&nbsp; If Dir(RegFile1) &lt;&gt; "" Or Dir(RegFile2) &lt;&gt; "" Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Dir(RegFile1) &lt;&gt; "" Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegFile1 = RegFile1 &amp; "/s" &amp; " " &amp; BeReg<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RetVal = Shell(RegFile1, 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegFile2 = RegFile2 &amp; "/s" &amp; " " &amp; BeReg<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RetVal = Shell(RegFile2, 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>&nbsp; Else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox "找不到regsvr32.exe文件,你可能无法使用本软件!", vbCritical, "无法自动注册控件"<BR>&nbsp; End If<BR>Else<BR>&nbsp; MsgBox "找不到控件文件!", vbCritical, "无法自动注册控件"<BR>End If<BR>End Function</P>
<P>每次执行到黑体部分就报错,(cad2002版)</P>
<P>并且已经引用了ObjectDBX.1</P>
<P>为何?我在cad2004版下已经可以用了<BR></P>

雪山飞狐_lzh 发表于 2005-7-13 18:39:00

<STRONG>Set objDbx = GetInterfaceObject("ObjectDBX.AxDbDocument")<BR></STRONG>

fanny_6 发表于 2005-7-14 08:38:00

<P>试过了没用,麻烦再帮我想想。谢了</P>

雪山飞狐_lzh 发表于 2005-7-14 10:47:00

<P>用这里的lisp函数注册一下试试:</P>
<P><A href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=8884" target="_blank" >http://bbs.mjtd.com/forum.php?mod=viewthread&tid=8884</A></P>

fanny_6 发表于 2005-7-14 10:53:00

<P>试过了,不行。</P>
<P>怎样才能判断是否注册成功呢,谢谢</P>

fanny_6 发表于 2005-7-15 08:42:00

<P>斑竹救我</P>
<P>想的脑袋都破了</P>

fanny_6 发表于 2005-7-15 08:50:00

<P>麻烦哪位传个基于ObjectDBX,且带ObjectDBX注册,可在2000上使用的程序上来。</P>
<P>我先看看</P>
页: [1]
查看完整版本: 关于控件注册