<?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: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318816#M94366</link>
    <description>Mark - Yes, I know about the bug in the Activated event.&lt;BR /&gt;
&lt;BR /&gt;
However, I'm quite puzzled by your suggestion that&lt;BR /&gt;
you have a workaround, since there are no other events&lt;BR /&gt;
available to VB that would serve as a means of working&lt;BR /&gt;
around the problem.&lt;BR /&gt;
&lt;BR /&gt;
The performance problem has nothing to do with VB, or&lt;BR /&gt;
the language in use.  The same problem exists with any &lt;BR /&gt;
controller regardless of what language it is written&lt;BR /&gt;
in. The reason is very simple: There are three events&lt;BR /&gt;
on the Document events interface that fire at a very&lt;BR /&gt;
high frequency:&lt;BR /&gt;
&lt;BR /&gt;
  ObjectAdded&lt;BR /&gt;
  ObjectModified&lt;BR /&gt;
  ObjectErased&lt;BR /&gt;
&lt;BR /&gt;
These events fire every time an object is added, &lt;BR /&gt;
erased, or modified. Because of the way ActiveX&lt;BR /&gt;
events work, an event-sinking controller must handle&lt;BR /&gt;
ALL of the events on an outgoing event interface,&lt;BR /&gt;
regardless of whether the programmer is interested&lt;BR /&gt;
in the event or not. &lt;BR /&gt;
&lt;BR /&gt;
Mark Holder wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Tony-&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks for looking at my little widget.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; When I first saw your post, I wondered whether you just stumbled onto that&lt;BR /&gt;
&amp;gt; problem or if you had reason to suspect it would be there. It seems that&lt;BR /&gt;
&amp;gt; AutoCAD does not fire the Activate event when the active document is changed&lt;BR /&gt;
&amp;gt; by an automation api call. I'm guessing you knew that already. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; To my surprise, I managed to come up with a workaround using the events that&lt;BR /&gt;
&amp;gt; do fire. I'm going to do a bit more testing before I post an update, though.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; BTW: Frank indicates that performance problems are to be expected from a VB&lt;BR /&gt;
&amp;gt; implementation of this capability. Do you agree, and if so, would you mind&lt;BR /&gt;
&amp;gt; reposting that Lisp code you posted earlier for benchmarking? I can't find&lt;BR /&gt;
&amp;gt; anything since Autodesk "improved" their web presence.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks again for the input. I hope this message gets through...&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
/*********************************************************/&lt;BR /&gt;
/*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
/* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
/* ----------------------------------------------------- */&lt;BR /&gt;
/*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
/*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
/*********************************************************/</description>
    <pubDate>Thu, 30 Mar 2000 04:52:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-03-30T04:52:53Z</dc:date>
    <item>
      <title>Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318806#M94356</link>
      <description>A few weeks ago, a request was made for a component that can&lt;BR /&gt;
provide an event when a document is activated and when&lt;BR /&gt;
AutoCAD is closed, and a couple of other things. Since the&lt;BR /&gt;
changes have been made to the newsgroups, I can't find the&lt;BR /&gt;
original post nor the newsgroup search.&lt;BR /&gt;
&lt;BR /&gt;
TrackA2K.DLL in the attached Zip file may provide a solution&lt;BR /&gt;
for at least some of the functionality requested. &lt;BR /&gt;
&lt;BR /&gt;
The other DLL in the Zip is XTimers.DLL, which comes with&lt;BR /&gt;
the Coffee VB6 sample application from Microsoft.&lt;BR /&gt;
&lt;BR /&gt;
After registering both DLLs with Regsvr32, the code you need&lt;BR /&gt;
looks like this&lt;BR /&gt;
&lt;BR /&gt;
Private WithEvents myDocTracks As TrackA2K.DocTracks&lt;BR /&gt;
Private myAcad As AcadApplication&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
Set myAcad = CreateObject("AutoCAD.Application.15")&lt;BR /&gt;
If Err Then&lt;BR /&gt;
   MsgBox "Could not get an instance of AutoCAD"&lt;BR /&gt;
Else&lt;BR /&gt;
   Set myDocTracks = New DocTracks&lt;BR /&gt;
   If Err Then&lt;BR /&gt;
      MsgBox "Could not get an instance of&lt;BR /&gt;
TrackA2K.DocTracks"&lt;BR /&gt;
   End If&lt;BR /&gt;
   &lt;BR /&gt;
   Set myDocTracks.Acad = myAcad&lt;BR /&gt;
   myAcad.Visible = True&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
The DocTracks object exposes 3 events:&lt;BR /&gt;
&lt;BR /&gt;
OnQuit()&lt;BR /&gt;
   Fired when the AutoCAD session exits. Set myAcad=Nothing&lt;BR /&gt;
and myDocTracks=Nothing in this event, along with anything&lt;BR /&gt;
else you need to do.&lt;BR /&gt;
&lt;BR /&gt;
WillQuit()&lt;BR /&gt;
   Fired before message boxes for saving or not saving are&lt;BR /&gt;
presented. OnQuit will not fire if cancel is chosen on any&lt;BR /&gt;
Save prompt.&lt;BR /&gt;
&lt;BR /&gt;
OnActivate(ByVal aDoc as AcadDocument)&lt;BR /&gt;
   Fired when a new document is opened or created.&lt;BR /&gt;
&lt;BR /&gt;
Any comments are welcome&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder</description>
      <pubDate>Fri, 24 Mar 2000 20:50:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318806#M94356</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T20:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318807#M94357</link>
      <description>Frank-&lt;BR /&gt;
&lt;BR /&gt;
The only reason I can think of to get that error would be&lt;BR /&gt;
opening a second (read-only) copy of a drawing. Have you&lt;BR /&gt;
tried it with code exactly like I posted?&lt;BR /&gt;
&lt;BR /&gt;
I'll test it on an already open session to see if there is a&lt;BR /&gt;
problem when &amp;gt;1 drawing is already open when you set the&lt;BR /&gt;
Acad property.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Hi Mark. I keep getting a run-time error 457 "This key is already associated&lt;BR /&gt;
&amp;gt; with an element of this collection" whenever I try to set the Acad property&lt;BR /&gt;
&amp;gt; of a DocTacks object. Am I doing something wrong?&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Fri, 24 Mar 2000 21:20:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318807#M94357</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T21:20:01Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318808#M94358</link>
      <description>Frank-&lt;BR /&gt;
&lt;BR /&gt;
I tested it using GetObject to get an existing session with&lt;BR /&gt;
2 drawings open, and got no error. Do you need to have 2&lt;BR /&gt;
copies of the same drawing open? If so, I can easily fix the&lt;BR /&gt;
DLL so it does not matter.&lt;BR /&gt;
&lt;BR /&gt;
Thenks, &lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Frank Oquendo wrote:&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Hi Mark. I keep getting a run-time error 457 "This key is already associated&lt;BR /&gt;
&amp;gt; &amp;gt; with an element of this collection" whenever I try to set the Acad property&lt;BR /&gt;
&amp;gt; &amp;gt; of a DocTacks object. Am I doing something wrong?&lt;BR /&gt;
&amp;gt; &amp;gt;</description>
      <pubDate>Fri, 24 Mar 2000 21:29:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318808#M94358</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T21:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318809#M94359</link>
      <description>Frank-&lt;BR /&gt;
&lt;BR /&gt;
I get the events on the drawing that was active when the&lt;BR /&gt;
DocTracks' Acad property is set, and only get the runtime&lt;BR /&gt;
error if the same dwg is opened more than once.&lt;BR /&gt;
&lt;BR /&gt;
BTW 1: The events only fire correctly if the DocTracks&lt;BR /&gt;
object is instantiated with New, not with CreateObject or&lt;BR /&gt;
GetInterfaceObject from an out of process client.&lt;BR /&gt;
&lt;BR /&gt;
BTW 2: I have not yet tried it from an in-process client.&lt;BR /&gt;
I'll do so now...&lt;BR /&gt;
&lt;BR /&gt;
Thanks, Mark Holder</description>
      <pubDate>Fri, 24 Mar 2000 21:35:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318809#M94359</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T21:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318810#M94360</link>
      <description>Frank-&lt;BR /&gt;
&lt;BR /&gt;
Yes, I am using FullName to index the docs. For some reason,&lt;BR /&gt;
I don't get an error when &amp;gt;1 unnamed dwg is open, though.&lt;BR /&gt;
Hmmm...&lt;BR /&gt;
&lt;BR /&gt;
There is no real reason to do so in this app, it just&lt;BR /&gt;
carried over from the original app I developed the tool for.&lt;BR /&gt;
I'll redo that part.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Here's an update: you're using the FullName property to index your&lt;BR /&gt;
&amp;gt; documents, aren't you? The problem only occurs if there's more than one&lt;BR /&gt;
&amp;gt; unnamed drawing open when the object is created. You may want to consider&lt;BR /&gt;
&amp;gt; using a test to determine whether to index on the FullName or just the Name.&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Fri, 24 Mar 2000 21:41:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318810#M94360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T21:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318811#M94361</link>
      <description>Frank-&lt;BR /&gt;
&lt;BR /&gt;
Oops - I forgot to watch for new drawings. Here is a new&lt;BR /&gt;
version that does, and does not index on FullName, so the&lt;BR /&gt;
same drawing can be opened more than once.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; The problems I'm having are centered on unnamed drawings:&lt;BR /&gt;
&amp;gt; 1) Multiple unnamed drawings prior to instantiation crashes the app&lt;BR /&gt;
&amp;gt; 2) Unnamed drawings created after instantiation do not trigger the&lt;BR /&gt;
&amp;gt; OnActivate event&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; With named (saved) documents, everything works beautifully. I believe it's&lt;BR /&gt;
&amp;gt; the unconditional use of the FullName property that is causing these&lt;BR /&gt;
&amp;gt; problems.</description>
      <pubDate>Fri, 24 Mar 2000 22:13:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318811#M94361</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T22:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318812#M94362</link>
      <description>Frank-&lt;BR /&gt;
&lt;BR /&gt;
Let me think about distribution. I'll look at Autodesk's web&lt;BR /&gt;
store first, if it still exists, and I can locate it.&lt;BR /&gt;
&lt;BR /&gt;
BTW: What about your "switch state" thing? I don't remember&lt;BR /&gt;
exactly what it was supposed to do.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Excellent! That's got it. Now for the thorny part: what's your&lt;BR /&gt;
&amp;gt; redistribution policy? Is this freeware? Will you be donating the code to&lt;BR /&gt;
&amp;gt; the public domain? If you're going to retain ownership, will I need to buy&lt;BR /&gt;
&amp;gt; license to distribute your application with my own? If you'd rather not&lt;BR /&gt;
&amp;gt; discuss these matters here, please feel free to email me directly. Just&lt;BR /&gt;
&amp;gt; reply to this message and remove the "nospam." Thanks for all your effort,&lt;BR /&gt;
&amp;gt; Mark. I appreciate it.&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Fri, 24 Mar 2000 22:37:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318812#M94362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T22:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318813#M94363</link>
      <description>VB6 sp3&lt;BR /&gt;
&lt;BR /&gt;
Mark&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo wrote:&lt;BR /&gt;
&lt;SNIP&gt; BTW, what is this dll written in?&lt;/SNIP&gt;</description>
      <pubDate>Fri, 24 Mar 2000 22:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318813#M94363</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-24T22:54:15Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318814#M94364</link>
      <description>Mark - Your server's OnActivateDocument event does not &lt;BR /&gt;
fire when the Active document is changed via API calls &lt;BR /&gt;
(e.g., calling an AcadDocument's Activate() method). &lt;BR /&gt;
&lt;BR /&gt;
You can see this by using my QuickDoc demo program for&lt;BR /&gt;
my AcadX ActiveX server. If you click on the name of a&lt;BR /&gt;
document in the list, it is activated, but your event&lt;BR /&gt;
never fires (or at least, not in an out-of-process VB5&lt;BR /&gt;
test client).&lt;BR /&gt;
&lt;BR /&gt;
Nice try, though.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
/*********************************************************/&lt;BR /&gt;
/*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
/* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
/* ----------------------------------------------------- */&lt;BR /&gt;
/*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
/*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
/*********************************************************/</description>
      <pubDate>Sat, 25 Mar 2000 21:33:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318814#M94364</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-25T21:33:49Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318815#M94365</link>
      <description>Tony-&lt;BR /&gt;
&lt;BR /&gt;
Thanks for looking at my little widget.&lt;BR /&gt;
&lt;BR /&gt;
When I first saw your post, I wondered whether you just stumbled onto that&lt;BR /&gt;
problem or if you had reason to suspect it would be there. It seems that&lt;BR /&gt;
AutoCAD does not fire the Activate event when the active document is changed&lt;BR /&gt;
by an automation api call. I'm guessing you knew that already. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
To my surprise, I managed to come up with a workaround using the events that&lt;BR /&gt;
do fire. I'm going to do a bit more testing before I post an update, though.&lt;BR /&gt;
&lt;BR /&gt;
BTW: Frank indicates that performance problems are to be expected from a VB&lt;BR /&gt;
implementation of this capability. Do you agree, and if so, would you mind&lt;BR /&gt;
reposting that Lisp code you posted earlier for benchmarking? I can't find&lt;BR /&gt;
anything since Autodesk "improved" their web presence.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for the input. I hope this message gets through...&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:38DD30BD.C3ADD1F1@worldnet.att.net...&lt;BR /&gt;
&amp;gt; Mark - Your server's OnActivateDocument event does not&lt;BR /&gt;
&amp;gt; fire when the Active document is changed via API calls&lt;BR /&gt;
&amp;gt; (e.g., calling an AcadDocument's Activate() method).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; You can see this by using my QuickDoc demo program for&lt;BR /&gt;
&amp;gt; my AcadX ActiveX server. If you click on the name of a&lt;BR /&gt;
&amp;gt; document in the list, it is activated, but your event&lt;BR /&gt;
&amp;gt; never fires (or at least, not in an out-of-process VB5&lt;BR /&gt;
&amp;gt; test client).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Nice try, though.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; /*********************************************************/&lt;BR /&gt;
&amp;gt; /*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
&amp;gt; /* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
&amp;gt; /* ----------------------------------------------------- */&lt;BR /&gt;
&amp;gt; /*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
&amp;gt; /*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
&amp;gt; /*********************************************************/&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Tue, 28 Mar 2000 21:09:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318815#M94365</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-28T21:09:54Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318816#M94366</link>
      <description>Mark - Yes, I know about the bug in the Activated event.&lt;BR /&gt;
&lt;BR /&gt;
However, I'm quite puzzled by your suggestion that&lt;BR /&gt;
you have a workaround, since there are no other events&lt;BR /&gt;
available to VB that would serve as a means of working&lt;BR /&gt;
around the problem.&lt;BR /&gt;
&lt;BR /&gt;
The performance problem has nothing to do with VB, or&lt;BR /&gt;
the language in use.  The same problem exists with any &lt;BR /&gt;
controller regardless of what language it is written&lt;BR /&gt;
in. The reason is very simple: There are three events&lt;BR /&gt;
on the Document events interface that fire at a very&lt;BR /&gt;
high frequency:&lt;BR /&gt;
&lt;BR /&gt;
  ObjectAdded&lt;BR /&gt;
  ObjectModified&lt;BR /&gt;
  ObjectErased&lt;BR /&gt;
&lt;BR /&gt;
These events fire every time an object is added, &lt;BR /&gt;
erased, or modified. Because of the way ActiveX&lt;BR /&gt;
events work, an event-sinking controller must handle&lt;BR /&gt;
ALL of the events on an outgoing event interface,&lt;BR /&gt;
regardless of whether the programmer is interested&lt;BR /&gt;
in the event or not. &lt;BR /&gt;
&lt;BR /&gt;
Mark Holder wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Tony-&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks for looking at my little widget.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; When I first saw your post, I wondered whether you just stumbled onto that&lt;BR /&gt;
&amp;gt; problem or if you had reason to suspect it would be there. It seems that&lt;BR /&gt;
&amp;gt; AutoCAD does not fire the Activate event when the active document is changed&lt;BR /&gt;
&amp;gt; by an automation api call. I'm guessing you knew that already. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; To my surprise, I managed to come up with a workaround using the events that&lt;BR /&gt;
&amp;gt; do fire. I'm going to do a bit more testing before I post an update, though.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; BTW: Frank indicates that performance problems are to be expected from a VB&lt;BR /&gt;
&amp;gt; implementation of this capability. Do you agree, and if so, would you mind&lt;BR /&gt;
&amp;gt; reposting that Lisp code you posted earlier for benchmarking? I can't find&lt;BR /&gt;
&amp;gt; anything since Autodesk "improved" their web presence.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks again for the input. I hope this message gets through...&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
/*********************************************************/&lt;BR /&gt;
/*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
/* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
/* ----------------------------------------------------- */&lt;BR /&gt;
/*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
/*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
/*********************************************************/</description>
      <pubDate>Thu, 30 Mar 2000 04:52:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318816#M94366</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T04:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Document Activated Event</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318817#M94367</link>
      <description>Any idea why Frank has deleted all of his posts in this&lt;BR /&gt;
thread?&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; A few weeks ago, a request was made for a component that can&lt;BR /&gt;
&amp;gt; provide an event when a document is activated and when&lt;BR /&gt;
&amp;gt; AutoCAD is closed, and a couple of other things. Since the&lt;BR /&gt;
&amp;gt; changes have been made to the newsgroups, I can't find the&lt;BR /&gt;
&amp;gt; original post nor the newsgroup search.......&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
/*********************************************************/&lt;BR /&gt;
/*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
/* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
/* ----------------------------------------------------- */&lt;BR /&gt;
/*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
/*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
/*********************************************************/</description>
      <pubDate>Thu, 30 Mar 2000 04:56:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318817#M94367</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T04:56:51Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318818#M94368</link>
      <description>Tony-&lt;BR /&gt;
&lt;BR /&gt;
Surprisingly, the Deactivate event fires in the outgoing&lt;BR /&gt;
document even when an API call triggers the document switch.&lt;BR /&gt;
Unfortunately, I have not been able to get 100% reliability&lt;BR /&gt;
in handling document switches with it - almost, but not&lt;BR /&gt;
quite. I'm not sure if it is my code that's buggy or just&lt;BR /&gt;
quirks in the firing of the events. Since a fix has already&lt;BR /&gt;
been made to MCAD, I doubt it is worth pursuing anyway.&lt;BR /&gt;
Surely a fix for vanilla AutoCAD can't be too far away&lt;BR /&gt;
(???).&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; &lt;SNIP&gt;&lt;BR /&gt;
&amp;gt; However, I'm quite puzzled by your suggestion that&lt;BR /&gt;
&amp;gt; you have a workaround, since there are no other events&lt;BR /&gt;
&amp;gt; available to VB that would serve as a means of working&lt;BR /&gt;
&amp;gt; around the problem.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&lt;SNIP&gt;&lt;/SNIP&gt;&lt;/SNIP&gt;</description>
      <pubDate>Thu, 30 Mar 2000 13:27:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318818#M94368</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T13:27:51Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318819#M94369</link>
      <description>Tony-&lt;BR /&gt;
&lt;BR /&gt;
I didn't know posts could be deleted by the sender. Maybe&lt;BR /&gt;
they just got lost in the reorganization &lt;G&gt;. I notice his&lt;BR /&gt;
are not the only ones missing. Maybe Frank will clue us in.&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Any idea why Frank has deleted all of his posts in this&lt;BR /&gt;
&amp;gt; thread?&lt;/G&gt;</description>
      <pubDate>Thu, 30 Mar 2000 13:37:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318819#M94369</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T13:37:06Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318820#M94370</link>
      <description>Why can't you do this in simple VB6?&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Stuart Nathan @&lt;BR /&gt;
http://www.office-manager.co.uk</description>
      <pubDate>Thu, 30 Mar 2000 15:24:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318820#M94370</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T15:24:50Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318821#M94371</link>
      <description>Mark - What product/release are you referring to by 'MCAD'?&lt;BR /&gt;
&lt;BR /&gt;
Can you do a _VERNUM on it and tell me what it says?&lt;BR /&gt;
&lt;BR /&gt;
Regardless of whether you find a workaround for the document &lt;BR /&gt;
activated problem, you're still not going to circumvent the&lt;BR /&gt;
performance problem using VB. Others have done exactly, or&lt;BR /&gt;
nearly the same thing you're doing, and all of their efforts&lt;BR /&gt;
have eventually hit the same wall (there is sample code that&lt;BR /&gt;
is posted in the customer-files newsgroup that isn't very much &lt;BR /&gt;
different from what you're doing).&lt;BR /&gt;
&lt;BR /&gt;
I'm sorry that Frank's lack of programming experience, and&lt;BR /&gt;
lack of understanding the underlying problem has mislead you &lt;BR /&gt;
into believing that you have come up with a 'breakthrough' &lt;BR /&gt;
of some sort, but unfortunately, that's not the case. There&lt;BR /&gt;
is only one acceptable solution to the problem, and that is&lt;BR /&gt;
to use ARX to source the events, as my AcadX server does.&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Tony-&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Surprisingly, the Deactivate event fires in the outgoing&lt;BR /&gt;
&amp;gt; document even when an API call triggers the document switch.&lt;BR /&gt;
&amp;gt; Unfortunately, I have not been able to get 100% reliability&lt;BR /&gt;
&amp;gt; in handling document switches with it - almost, but not&lt;BR /&gt;
&amp;gt; quite. I'm not sure if it is my code that's buggy or just&lt;BR /&gt;
&amp;gt; quirks in the firing of the events. Since a fix has already&lt;BR /&gt;
&amp;gt; been made to MCAD, I doubt it is worth pursuing anyway.&lt;BR /&gt;
&amp;gt; Surely a fix for vanilla AutoCAD can't be too far away&lt;BR /&gt;
&amp;gt; (???).&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
/*********************************************************/&lt;BR /&gt;
/*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
/* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
/* ----------------------------------------------------- */&lt;BR /&gt;
/*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
/*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
/*********************************************************/</description>
      <pubDate>Thu, 30 Mar 2000 17:57:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318821#M94371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T17:57:49Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318822#M94372</link>
      <description>Tony-&lt;BR /&gt;
&lt;BR /&gt;
The info I got was that a fix has been made to Mechanical&lt;BR /&gt;
Desktop 4.0 (T133 vs T098 for plain AutoCAD, T108 for my&lt;BR /&gt;
AutoCAD with the service pack).&lt;BR /&gt;
&lt;BR /&gt;
Also, I didn't really think this was supposed to be&lt;BR /&gt;
something hard to do. The Autodesk docs make it sound like&lt;BR /&gt;
something any automation client should be able to do easily.&lt;BR /&gt;
It just gets hard when you try to make it work like it&lt;BR /&gt;
should. I haven't looked in customer files for quite a while&lt;BR /&gt;
now due to time limits.&lt;BR /&gt;
&lt;BR /&gt;
As far a performance, I don't observe a perceptible&lt;BR /&gt;
degradation when I have AcadDocument objects declared&lt;BR /&gt;
WithEvents. I'd be interested in any additional info or&lt;BR /&gt;
links you may have on this subject. &lt;BR /&gt;
&lt;BR /&gt;
Do you know if it helps to delete the definitions of the&lt;BR /&gt;
ObjectModified, ObjectAdded, and ObjectErased events&lt;BR /&gt;
entirely?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Mark Holder&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Mark - What product/release are you referring to by 'MCAD'?&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Can you do a _VERNUM on it and tell me what it says?&lt;BR /&gt;
&amp;gt; &lt;SNIP&gt;&lt;/SNIP&gt;</description>
      <pubDate>Thu, 30 Mar 2000 21:55:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/document-activated-event/m-p/318822#M94372</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-03-30T21:55:56Z</dc:date>
    </item>
  </channel>
</rss>

