I have a .dll that uses registry entries to load itself when AutoCAD starts.
But I have encountered a problem where it also loads even
When a customer chooses to load another AutoCAD plugin by another vendor.
I would like it ideally only to be loaded when the user clicks on my desktop shortcut.
I am writing in VB.net & have noticed some vendors use a reference to
object.arx in their shortcut. Is it possible to do this with a vb.net .dll or even a lisp?
Any help would be greatly appreciated.
Solved! Go to Solution.
Couple of ways of doing this, I think. Might depend on what your desktop shortcut does e.g. point to a specific profile? The demand-load flags are set in the HKEY_LOCAL_MACHINE section of the registry so they don't depend on a specific profile. Not sure, there may be additional sections in the HKCU for newer versions but I think those are still independant of a specific profile.
One is to change the demand-load settings to command-detect, provided you have commands defined; no command issued, no DLL loaded.
Another would be to use a "loader" DLL, LSP, MNL, etc. as an intermediary to check the profile name at start-up. If its the correct profile name (or other circumstances) then make a call to System.Reflection (dotNET), (command "NETLOAD"...) (LISP), etc. You still need to load the "loader", but it can be much less obtrusive.
You could also modify the shortcut to call a start-up script (/b I think...) which makes a call to NETLOAD.
If you are going to fly by the seat of your pants, expect friction burns.
Adopt. Adapt. Overcome. Or be overcome.
I was also going to suggest the use of an .MNL file matching the name of the .cuix, which would cause the .dll to be netloaded whenever the .cuix was loaded, however, it is worth pointing out that just about no matter what you do, a savvy user will still be able to figure out how to load your .dll without using your shortcut.
If you have a specific case where you do not want your .dll to be loaded, then the only suggestion I would have is that in your applications Initialize routine (assuming you are implementing iExtensionApplication) you can test for conditions that you don't want, and throw an exception, which will prevent your app from loading.