zetazee Posted October 24, 2011 Posted October 24, 2011 (edited) I created a dll and wanted to auto netload it upon launch of AutoCAD Arch. I have used the following instructions in http://http://through-the-interface.typepad.com/through_the_interface/2006/09/automatic_loadi.html "DESCRIPTION"="AutoNetloadDLL" "LOADCTRLS"=dword:00000002 "MANAGED"=dword:00000001 "LOADER"="C:\MyApp\bin\Release\MyApp.dll" However, when i typed in my commands for the dll, AutoCAD displayed Unknown Command "". Press F1 for help. I have tried suggestions by people comments in the above link (i.e. setting acdbmgd.dll and acmgd.dll to Copy Local = False, restarting computer) , but I have done so, and the error still persists. I also have used the method as suggested by writing a STARTUP lisp function to auto netload the dll file in http://www.cadtutor.net/forum/showthread.php?42633-Automatic-Loading-of-.DLL-files-etc&highlight=netload But the same error persists. Would like to ask if anyone has encountered the same issue before, and can enlighten me on how to solve this problem? I have used Process Explorer to check if acad.exe has loaded the DLL, and it did! But the commands are not found. When I manually netload the dll by typing the netload command and selecting the dll, there is no such issue. This only occurs to me when I tried the auto methods. The methods only works so far if I launch acad.exe through Debug mode in VS2008. Definitely need to auto netload the DLL for my application, when AutoCAD Arch startups. Edited October 24, 2011 by zetazee Quote
Jeff H Posted October 24, 2011 Posted October 24, 2011 You need to somehow netload it manuly or have lisp do it and put code in the Intialize method or commands like below to set registery values. Is "LOADER"="C:\MyApp\bin\Release\MyApp.dll" the full path? <CommandMethod("RegisterApp")> _ Public Sub RegisterApp() Dim prodKey As String = HostApplicationServices.Current.RegistryProductRootKey Dim appName As String = "WhatEverNameYouWantToUse" Dim regAcadProdKey As RegistryKey = Registry.CurrentUser.OpenSubKey(prodKey) Dim regAcadAppKey As RegistryKey = regAcadProdKey.OpenSubKey("Applications", True) Dim subKeys() As String = regAcadAppKey.GetSubKeyNames() For Each subKey As String In subKeys If (subKey.Equals(appName)) Then regAcadAppKey.Close() Exit Sub End If Next Dim assemblyPath As String = Assembly.GetExecutingAssembly().Location Dim regAppAddInKey As RegistryKey = regAcadAppKey.CreateSubKey(appName) regAppAddInKey.SetValue("DESCRIPTION", appName, RegistryValueKind.String) regAppAddInKey.SetValue("LOADCTRLS", 14, RegistryValueKind.DWord) regAppAddInKey.SetValue("LOADER", assemblyPath, RegistryValueKind.String) regAppAddInKey.SetValue("MANAGED", 1, RegistryValueKind.DWord) regAcadAppKey.Close() End Sub <CommandMethod("UnregisterApp")> _ Public Sub UnregisterApp() Dim prodKey As String = HostApplicationServices.Current.RegistryProductRootKey Dim appName As String = "WhatEverNameYouWantToUse" Dim regAcadProdKey As RegistryKey = Registry.CurrentUser.OpenSubKey(prodKey) Dim regAcadAppKey As RegistryKey = regAcadProdKey.OpenSubKey("Applications", True) ' regAcadAppKey.DeleteSubKeyTree(appName) regAcadAppKey.Close() End Sub Quote
zetazee Posted October 25, 2011 Author Posted October 25, 2011 Hi Jeff, manual netload method is working fine, but I want my DLL app to be loaded automatically when AutoCAD launches. I have used the registry and LISP method. But the DLL app though is loaded, the commands didn't get recognized. I do see some difference with registry values set. I will try to set "LOADCTRLS" to 14 Dword value to see whether it helps. Quote
Jeff H Posted October 25, 2011 Posted October 25, 2011 Hey zetazee, Sorry I meant Netload manually the first time. Hopefully that change works Quote
zetazee Posted October 25, 2011 Author Posted October 25, 2011 Hi Jeff, Thanks for the assistance. I managed to solve my problem. It's to do with my dll reading the app.config file which confuses with the acad.exe.config file settings. Hence my intended settings were not loaded, and causing the commands to not be recognized. Quote
Kerry Brown Posted October 26, 2011 Posted October 26, 2011 may be a slash issue you use "LOADER"="C:\MyApp\bin\Release\MyApp.dll" try "LOADER"="C:\\MyApp\\bin\\Release\\MyApp.dll" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.