无法创建ActiveX组件异常 [英] Cannot create ActiveX component exception

查看:1346
本文介绍了无法创建ActiveX组件异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在开发一个小的vb.net表单应用程序.尝试使用以下代码加载Autocad.

Hi everyone,

I am develpoing a small vb.net forms application. From that trying to load the Autocad using the following code.

Dim mycadAp As AcadApplicationmycadAp = CreateObjec(AutoCAD.Application)
mycadAp.Visible = TRUE


首次创建应用程序时,它可以正常工作.正确加载Autocad.但是,如果第二次运行该应用程序,则会发生以下运行时错误.

无法在CreateObject行上创建ActiveX组件.
我无法预测出什么问题.我已在程序中包含以下参考.


When creating the application for first time, it works fine. Loads the Autocad correctly. But for second time if run the application the following runtime error is occuring.

Cannot create ActiveX component at the CreateObject line.
I cant predict what is the problem. I''ve included the following references in my program.

Imports Autodesk.AutoCAD.InteropImports Autodesk.AutoCAD.Interop.CommonPlease help me in this.



以上所有内容都可以在Autocad2010上正常使用,而所有问题仅在Autocad 2011上可用.
预先感谢,
Shiva.



The all above said are working properly with Autocad2010, all problem with Autocad 2011 only.

Thanks in advance,
Shiva.

推荐答案

也许此服务器组件只能启动一次?您可以在首次调用后尝试使用GetObject而不是CreateObject.

您可以简单地创建一个函数来检查是否已调用CreateObject并相应地使用CreateObject或GetObject返回对象.

带有一些额外信息的链接:
http://msdn.microsoft.com/en-us/library/aa164798(office .10).aspx [ ^ ]

祝您好运!
Maybe this server component can only be started once? You could try to use GetObject instead of CreateObject after first call.

You could simply make a function for this checking if the CreateObject was already called and return the object using CreateObject or GetObject accordingly.

A link with some extra info:
http://msdn.microsoft.com/en-us/library/aa164798(office.10).aspx[^]

Good luck!


您尝试过在GAC中注册该dll ....:)
have you tried with register this dll in GAC.... :)


这篇关于无法创建ActiveX组件异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆