我发现一个代码在AutoCAD中打开DWG文件与ObjectARX的commands.this代码工作顺利,当我在一个类库项目写的,但是当我想要把这个代码在问题发生我的Windows应用程序。它给我这个错误信息:错误:typeInitializationException
'<模块>'的类型初始值设定项引发异常。
内例外:C++模块失败过程 初始化期间加载。
我的代码是:
String MyDWGFilePath = @"\\Server\SharedFolder\Projects\File1.dwg";
DocumentCollection dm = Application.DocumentManager;
Document doc = null;
if(File.Exists(MyDWGFilePath))
{
doc = dm.Open(MyDWGFilePath, false);
Application.DocumentManager.MdiActiveDocument = doc;
}
注:我已经从AutoCAD安装文件夹从COM引用添加acdbmgd.dll和acmgd.dll也AutoCAD和AXDBLib。
请帮我...
没有你尝试添加类库作为参考Windows项目,然后调用打开DWG文件的类库中的函数? – 2012-01-03 09:16:31
是的,但我再次收到该错误。 – 2012-01-03 10:25:02