<?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 Re: VB.net Addin unload itself? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9186080#M103727</link>
    <description>&lt;P&gt;Hello pball,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1041683"&gt;@pball&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I would like a DLL addin to be able to unload it self. I found some code that works running it from VBA but not from inside my addin. Is is possible for an addin to unload itself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisApplication.ApplicationAddIns.ItemById("{idstringhere]").Deactivate()&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I got same result with c# now. It seems that the add-ins cannot be disabled by themselves.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the add-in is only disabled by Deactivate() and the dll isn't unloaded.&lt;/P&gt;&lt;P&gt;(To unload the dll, you must restart Inventor.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2019 00:01:16 GMT</pubDate>
    <dc:creator>HideoYamada</dc:creator>
    <dc:date>2019-12-06T00:01:16Z</dc:date>
    <item>
      <title>VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9185848#M103722</link>
      <description>&lt;P&gt;I would like a DLL addin to be able to unload it self. I found some code that works running it from VBA but not from inside my addin. Is is possible for an addin to unload itself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisApplication.ApplicationAddIns.ItemById("{idstringhere]").Deactivate()&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 21:31:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9185848#M103722</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2019-12-05T21:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9186080#M103727</link>
      <description>&lt;P&gt;Hello pball,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1041683"&gt;@pball&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I would like a DLL addin to be able to unload it self. I found some code that works running it from VBA but not from inside my addin. Is is possible for an addin to unload itself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisApplication.ApplicationAddIns.ItemById("{idstringhere]").Deactivate()&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I got same result with c# now. It seems that the add-ins cannot be disabled by themselves.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the add-in is only disabled by Deactivate() and the dll isn't unloaded.&lt;/P&gt;&lt;P&gt;(To unload the dll, you must restart Inventor.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 00:01:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9186080#M103727</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-06T00:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187361#M103764</link>
      <description>&lt;P&gt;I am able to self-deactivate in C# in Inventor 2017.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 15:02:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187361#M103764</guid>
      <dc:creator>jjstr8</dc:creator>
      <dc:date>2019-12-06T15:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187424#M103765</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a new add in to unload the add in you want to unload!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 15:28:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187424#M103765</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-12-06T15:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187428#M103767</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/111000"&gt;@jjstr8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I am able to self-deactivate in C# in Inventor 2017.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I tried with Inventor 2020 and got an exception.&lt;/P&gt;&lt;P&gt;Where did you do "Deactivate()"? I did at "OnExecute()".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;Freeradical&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 15:28:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187428#M103767</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-06T15:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187742#M103773</link>
      <description>&lt;P&gt;It was in an OnExecute method for one of my command's button definition.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 17:42:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187742#M103773</guid>
      <dc:creator>jjstr8</dc:creator>
      <dc:date>2019-12-06T17:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187751#M103774</link>
      <description>&lt;P&gt;If that's exactly what you're using, the ']' at the end should be a '}'&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 17:47:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9187751#M103774</guid>
      <dc:creator>jjstr8</dc:creator>
      <dc:date>2019-12-06T17:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9189471#M103787</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/111000"&gt;@jjstr8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;If that's exactly what you're using, the ']' at the end should be a '}'&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You are right!&lt;/P&gt;&lt;P&gt;I could deactive with Inventor 2020.&lt;/P&gt;&lt;P&gt;(I had specified the internal name of AddIn to the argument of ItemById at my test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;We have to use clsid that described in the manifest.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 12:03:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9189471#M103787</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-08T12:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190607#M103804</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/555733"&gt;@HideoYamada&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please could you share your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 10:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190607#M103804</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-12-09T10:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190724#M103808</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/241746"&gt;@GeorgK&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;please could you share your code.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The codes and complied dll are attached to this post.&lt;/P&gt;&lt;P&gt;Please try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 11:47:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190724#M103808</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-09T11:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190772#M103811</link>
      <description>&lt;P&gt;Sorry, I tried with C#.&lt;/P&gt;&lt;P&gt;I'll try with VB.net if you need. (Please let me know if so.)&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 12:08:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190772#M103811</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-09T12:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190783#M103812</link>
      <description>&lt;P&gt;Great. Thank you.&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 12:11:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190783#M103812</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-12-09T12:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190979#M103822</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/111000"&gt;@jjstr8&lt;/a&gt;I checked and that typo is just in my post, the addin ID is properly formatted in my real code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Long story short I noticed calling the sub where I try to deactivate the addin from the main Activate sub in the addin failed. While calling the sub after Inventor was started up worked. So I played around a bit and found the application events on ready event. Calling my sub from there works just fine. The only difference is instead of happening while the splash screen is up it happens after Inventor has loaded which isn't an issue for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        Private Sub m_appevents_onready() Handles m_ApplicationEvents.OnReady
            Log_User() 'This sub has the deactivate line in it
        End Sub&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Dec 2019 13:41:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9190979#M103822</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2019-12-09T13:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9191170#M103829</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't know the event 'OnReady'. This seems useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can, could you tell me the scenario why Deactivate at Activate?&lt;/P&gt;&lt;P&gt;Are you trying to cancel activation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 14:47:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9191170#M103829</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-09T14:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9191278#M103833</link>
      <description>&lt;P&gt;People around here do not like to update the company Addin I manage and I haven't found a simple way to have it auto update. So I finally got around to adding a nag if the addin is out of date. Figured I could also have the addin stop working so people would be more likely to update it. Sadly that nag and time bomb feature will only start working with the next update, assuming people update to this version lol.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 15:37:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9191278#M103833</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2019-12-09T15:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9194905#M103891</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1041683"&gt;@pball&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;People around here do not like to update the company Addin I manage and I haven't found a simple way to have it auto update. So I finally got around to adding a nag if the addin is out of date. Figured I could also have the addin stop working so people would be more likely to update it. Sadly that nag and time bomb feature will only start working with the next update, assuming people update to this version lol.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As far as I know, Inventor will not mark as "Loaded" if an exception is thrown at the add-in's Activate() to Inventor.&lt;/P&gt;&lt;P&gt;So I think you just throw some exception in Activate() to avoid the actication.&lt;/P&gt;&lt;P&gt;In this case Deactivate() will not be called and so you must release the resources if you have obtained at Activate().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it is more friendly that the alert message will be shown when the command is executed, rather than suddenly the add-in disappears.&lt;/P&gt;&lt;P&gt;(When the add-in disappears, you will get many phone calls from every users!!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And more one thing, even if the add-in has deactivated at OnReady(), users can reactivate it at Addin Manager and the add-in has been marked as loaded (activated).&lt;/P&gt;&lt;P&gt;In this scenario user can execute the command and the trouble may cause if you don't initialize the add-in completely if it is expired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 03:26:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9194905#M103891</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-12-11T03:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net Addin unload itself?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9195897#M103903</link>
      <description>&lt;P&gt;The user will get a message before the addin is deactivated. There are also only 8 users here and most if not all of them will immediately ask me if something doesn't work. Which will end up with me telling them to upgrade or stop complaining. So I'm not concerned about users re-enabling the addin or getting angry phone calls. If I was supporting a large group with this addin, I would invest the time into a better more seamless solution like automagical upgrading.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This addin is just something I made for personal use and shared with everyone because I'm nice. So I don't have large amounts of time to invest as it isn't explicitly something I'm paid or told to do.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 13:22:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vb-net-addin-unload-itself/m-p/9195897#M103903</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2019-12-11T13:22:03Z</dc:date>
    </item>
  </channel>
</rss>

