您的位置:首页 > 其它

让AutoCAD启动时自动加载应用程序

2016-04-25 14:27 323 查看
方法一:

1. 在AutoCAD安装目录找到c:\Program Files\AutoCAD 2006\Support\acad2006.lsp

用记事本打开,在最后加入(下段代码第二行即可,注意路径)


(if (not (= (substr (ver) 1 11) "Visual LISP")) (load "acad2006doc.lsp"))


(command "netload" "C:\\MXCAD\\bin\\Debug\\MXCAD.dll")


;; Silent load.


(princ)

2. AutoCAD设置(重要,必须设置):

工具-选项-文件-支持文件搜索路径-添加-浏览到MXCAD路径

方法二:

修改注册表,新建记事本文件,重命名为netload.reg,加入以下内容,然后双击文件将信息添加到注册表即可。


Windows Registry Editor Version 5.00




[HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:804\Applications\MXCAD]


"LOADER"="C:\\MXCAD\\bin\\Debug\\MXCAD.dll"


"MANAGED"=dword:0001c101


"LOADCTRLS"=dword:0001c102
"LOADCTRLS":控制程序随CAD加载的方式,设为Ox02随CAD启动一起加载;

"LOADER":告诉CAD所要加载的程序的路径;

"MANAGED":设为Ox01,告诉CAD这是托管程序。

-----------------------------

附注:注册表键值"LOADCTRLS"控制说明,控制ARX程序的加载方式(上例中使用的是Ox02随CAD启动一起加载)
0x01:Load the application upon detection of proxy object.

   当代理对像被控知时另载相应ARX程序.
0x02:Load the application upon AutoCAD startup.

   当AutoCAD启动时加载相应ARX程序.
0x04:Load the application upon invocation of a command.

   当输入命令时加载相应ARX程序.
0x08:Load the application upon request by the user or another application.

   当有用户或别的程序请求时加载相应ARX程序.
0x10:Do not load the application.

   从不加载该应用程序.
0x20:Load the application transparently.

   显式加载该应该程序.(不知该项译法是否有误)

-----------------------------

打包时,将上述注册表项添加到注册表中,即可实现安装时自动配置。


private bool WriteRegistryKey()


{


try


{


RegistryKey localMachine = Registry.LocalMachine;


RegistryKey SOFTWARE = localMachine.OpenSubKey("SOFTWARE", true);


RegistryKey Autodesk = SOFTWARE.OpenSubKey("Autodesk", true);


RegistryKey AutoCAD = Autodesk.OpenSubKey("AutoCAD", true);


RegistryKey R16_2 = AutoCAD.OpenSubKey("R16.2", true);


RegistryKey ACAD = R16_2.OpenSubKey("ACAD-4001:804", true);


RegistryKey Applications = ACAD.OpenSubKey("Applications", true);




RegistryKey MXCAD = Applications.CreateSubKey("MXCAD");


MXCAD.SetValue("LOADCTRLS", 0x02);


MXCAD.SetValue("LOADER", this.targetdir + @"bin\Debug\MXCAD.dll");


MXCAD.SetValue("MANAGED", 0x01);


return true;


}


catch


{


return false;


}


}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: