.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run command when .dll is loaded

1 REPLY 1
SOLVED
Reply
Message 1 of 2
My_Civil_3D
192 Views, 1 Reply

Run command when .dll is loaded

Hi i am looking for a method to impement a way to check certain autocad variable settings every time the dll is loaded( autocad starts).  Is there a way other than command method to run commands without the user launching them?

Civil 3D Certified Professional
1 REPLY 1
Message 2 of 2
norman.yuan
in reply to: My_Civil_3D

A class that implement IExtensionApplication would always run the Initialize() method when the DLL is loaded:

 

public class MyPlugin : IExtensionApplication

{

    // this method is called when the DLL is loaded

    public void Initialize()

    {

        // you code here to check the MdiActiveDocument settings

        // you may also handle DocumentCreated event, so that whenever

        // a new drawing or a drawing file is opened, you can also check the 

       // drawing settings

    }

 

    // this method is called when AutoCAD quits

    public void Terminate()

    {

         // in most cases you probably do not need to do anything here

    }

 

   // your other code of the class goes here...

}

 

Make sure you use try...catch to wrap the code in the Initialize(), if the code may result in runtime exception.

Norman Yuan

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report