• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Distinguished Contributor
    Posts: 123
    Registered: ‎09-30-2008
    Accepted Solution

    Load a .dll from desktop shortcut?

    229 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:
    Please use plain text.
    *Expert Elite*
    dgorsman
    Posts: 3,297
    Registered: ‎10-12-2006

    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.


    Please use plain text.
    *Expert Elite*
    chiefbraincloud
    Posts: 736
    Registered: ‎02-13-2008

    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
    Please use plain text.
    Distinguished Contributor
    Posts: 123
    Registered: ‎09-30-2008

    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:
    Please use plain text.