.NET

Reply
Distinguished Contributor
quigs
Posts: 143
Registered: ‎09-30-2008
Message 1 of 4 (371 Views)
Accepted Solution

Load a .dll from desktop shortcut?

371 Views, 3 Replies
02-29-2012 10:46 AM

Hello,

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.

 

Martin.

My name is Martin.. :smileyvery-happy:

Hi Guys,

I manged to do it using a script file refereced from the shortcut.

 

Cheers

 

Martin.

*Expert Elite*
dgorsman
Posts: 5,345
Registered: ‎10-12-2006
Message 2 of 4 (361 Views)

Re: Load a .dll from desktop shortcut?

02-29-2012 12:10 PM in reply to: quigs

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.
A good question will be halfway to a good answer.


*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 3 of 4 (352 Views)

Re: Load a .dll from desktop shortcut?

02-29-2012 12:56 PM in reply to: dgorsman

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.

Dave O.                                                                  Sig-Logos32.png
Distinguished Contributor
quigs
Posts: 143
Registered: ‎09-30-2008
Message 4 of 4 (351 Views)

Re: Load a .dll from desktop shortcut?

02-29-2012 01:02 PM in reply to: chiefbraincloud

Hi Guys,

I manged to do it using a script file refereced from the shortcut.

 

Cheers

 

Martin.

My name is Martin.. :smileyvery-happy:
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.