<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Run command when .dll is loaded in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/run-command-when-dll-is-loaded/m-p/12652235#M4955</link>
    <description>&lt;P&gt;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).&amp;nbsp; Is there a way other than command method to run commands without the user launching them?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Mar 2024 00:24:35 GMT</pubDate>
    <dc:creator>My_Civil_3D</dc:creator>
    <dc:date>2024-03-20T00:24:35Z</dc:date>
    <item>
      <title>Run command when .dll is loaded</title>
      <link>https://forums.autodesk.com/t5/net-forum/run-command-when-dll-is-loaded/m-p/12652235#M4955</link>
      <description>&lt;P&gt;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).&amp;nbsp; Is there a way other than command method to run commands without the user launching them?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 00:24:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/run-command-when-dll-is-loaded/m-p/12652235#M4955</guid>
      <dc:creator>My_Civil_3D</dc:creator>
      <dc:date>2024-03-20T00:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Run command when .dll is loaded</title>
      <link>https://forums.autodesk.com/t5/net-forum/run-command-when-dll-is-loaded/m-p/12652380#M4956</link>
      <description>&lt;P&gt;A class that implement IExtensionApplication would always run the Initialize() method when the DLL is loaded:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;public class MyPlugin : IExtensionApplication&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; // this method is called when the DLL is loaded&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; public void Initialize()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // you code here to check the MdiActiveDocument settings&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // you may also handle DocumentCreated event, so that whenever&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // a new drawing or a drawing file is opened, you can also check the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// drawing settings&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; // this method is called when AutoCAD quits&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; public void Terminate()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// in most cases you probably do not need to do anything here&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;// your other code of the class goes here...&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure you use try...catch to wrap the code in the Initialize(), if the code may result in runtime exception.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 02:51:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/run-command-when-dll-is-loaded/m-p/12652380#M4956</guid>
      <dc:creator>Norman_Yuan</dc:creator>
      <dc:date>2024-03-20T02:51:49Z</dc:date>
    </item>
  </channel>
</rss>

