天天看點

讓AutoCAD啟動時自動加載應用程式

 方法一:

  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; } }

繼續閱讀