让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;
}
}
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;
}
}
相关文章推荐
- org.springframework.web.servlet.DispatcherServlet noHandlerFound
- 一个简单的MD5加密算法C语言示例程序
- Android启动过程深入解析
- Sublime Text 3 快捷键总结(拿走)
- 在线将pdf转换成word格式的方法
- C/C++复习:整数排序(2)
- ssdtrain demo
- SpannableStringBuilder
- Android Studio AIDL 自定义类型找不到问题
- VR 第一篇
- 71、月薪3万的程序员都避开了哪些坑
- flashback_transaction_query(闪回)中undo_sql字段无值
- 文章索引~Socket 网络编程资料收集
- Android 65K问题之Multidex原理分析及NoClassDefFoundError的解决方法
- 数据结构与算法——不相交集类的C++实现
- linux net command /uboot command
- mysql的基本操作
- 运行android时Unable to resolve target 'Google Inc.:Google APIs:7'错误
- pytest使用说明
- mybatis中mapper 的namespace有什么用?