<?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: using COM during initilization in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288273#M26902</link>
    <description>&amp;gt; That code came straight out of the SDK, so I assumed it was correct.

Straight out of the SDK?  For what, a standalone COM
client?  An in-process ObjectARX COM server?

Where exactly did 'that code come straight out of'' ?

-- 
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com</description>
    <pubDate>Wed, 06 Apr 2005 19:01:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-04-06T19:01:26Z</dc:date>
    <item>
      <title>using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288270#M26899</link>
      <description>During the startup of a drawing, I am trying to load a menu via the COM 
interface (a modified version of the SDK example). I am doing this during the
AcRx::kLoadDwgMsg. The menu fails to load at this line:
if(::GetActiveObject(clsid, NULL, &amp;amp;pUnk) != S_OK),
something about "no document"
which sounds strange as there IS a document, and I am able to extract block
attributes from it during the same AcRx::kLoadDwgMsg.
After my init code has ran and Acad is in a "quiet" state, I can then enter my
load menu command at the promp and the code runs fine and loads the menu.
Is COM not fully initilized during this time?
How can I get this menu to load at startup?
Thanks for any "pointers"
Perry</description>
      <pubDate>Wed, 06 Apr 2005 15:46:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288270#M26899</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-06T15:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288271#M26900</link>
      <description>You don't use GetActiveObject() to get a pointer to the
Application object. You need to use AcadGetIDispatch(),
or acedGetAcadWinApp::GetIDispatch() (MFC).

-- 
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"perry" &lt;PERRY_LEETS&gt; wrote in message news:42540478$1_2@newsprd01...
&amp;gt; During the startup of a drawing, I am trying to load a menu via the COM interface (a modified version of the SDK 
&amp;gt; example). I am doing this during the
&amp;gt; AcRx::kLoadDwgMsg. The menu fails to load at this line:
&amp;gt; if(::GetActiveObject(clsid, NULL, &amp;amp;pUnk) != S_OK),
&amp;gt; something about "no document"
&amp;gt; which sounds strange as there IS a document, and I am able to extract block
&amp;gt; attributes from it during the same AcRx::kLoadDwgMsg.
&amp;gt; After my init code has ran and Acad is in a "quiet" state, I can then enter my
&amp;gt; load menu command at the promp and the code runs fine and loads the menu.
&amp;gt; Is COM not fully initilized during this time?
&amp;gt; How can I get this menu to load at startup?
&amp;gt; Thanks for any "pointers"
&amp;gt; Perry&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Wed, 06 Apr 2005 16:30:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288271#M26900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-06T16:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288272#M26901</link>
      <description>Tony Tanzillo wrote:
&amp;gt; You don't use GetActiveObject() to get a pointer to the
&amp;gt; Application object. You need to use AcadGetIDispatch(),
&amp;gt; or acedGetAcadWinApp::GetIDispatch() (MFC).
&amp;gt; 
That code came straight out of the SDK, so I assumed it was correct.
As I am still grappling with C/Arx I dont want to tackle COM for a long
time yet. Other than hacking existing code.
I guess there are no "Proper" examples of Arx/Com for me to use :(
Perry</description>
      <pubDate>Wed, 06 Apr 2005 17:51:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288272#M26901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-06T17:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288273#M26902</link>
      <description>&amp;gt; That code came straight out of the SDK, so I assumed it was correct.

Straight out of the SDK?  For what, a standalone COM
client?  An in-process ObjectARX COM server?

Where exactly did 'that code come straight out of'' ?

-- 
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com</description>
      <pubDate>Wed, 06 Apr 2005 19:01:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288273#M26902</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-06T19:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288274#M26903</link>
      <description>Tony Tanzillo wrote:
&amp;gt;&amp;gt;That code came straight out of the SDK, so I assumed it was correct.
&amp;gt; 
&amp;gt; 
&amp;gt; Straight out of the SDK?  For what, a standalone COM
&amp;gt; client?  An in-process ObjectARX COM server?
&amp;gt; 
&amp;gt; Where exactly did 'that code come straight out of'' ?
&amp;gt; 
C:\Program Files\ObjectARX 2002\docsamps\comsamps\AsdkPlainComSamp

Yes, I know Im in the "Stone ages" here with 2002.
Perry</description>
      <pubDate>Wed, 06 Apr 2005 19:43:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288274#M26903</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-06T19:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288275#M26904</link>
      <description>&amp;gt;&amp;gt;&amp;gt;That code came straight out of the SDK, so I assumed it was correct.
&amp;gt;&amp;gt;

&amp;gt; C:\Program Files\ObjectARX 2002\docsamps\comsamps\AsdkPlainComSamp

It's wrong.  The reason why you can't use GetActiveObject()
from an in-process client is that it can return any of several
running instances of AutoCAD, which may not be the one that
the ARX dll is loaded into.

Use this function to get a pointer to an IDispatch, that can
be queried for IAcadApplicatoin:

extern LPDISPATCH AcadGetIDispatch(bool bAddRef);

If your link fails, then add an underscore to the front
of the function name (e.g., _AcadGetIDispatch).

-- 
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"perry" &lt;PERRY_LEETS&gt; wrote in message news:42543ba2$1_1@newsprd01...
&amp;gt; Tony Tanzillo wrote:
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; Straight out of the SDK?  For what, a standalone COM
&amp;gt;&amp;gt; client?  An in-process ObjectARX COM server?
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; Where exactly did 'that code come straight out of'' ?
&amp;gt;&amp;gt;
&amp;gt;
&amp;gt; Yes, I know Im in the "Stone ages" here with 2002.
&amp;gt; Perry&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Thu, 07 Apr 2005 00:27:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288275#M26904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-07T00:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288276#M26905</link>
      <description>Tony Tanzillo wrote:
&amp;gt;&amp;gt;&amp;gt;&amp;gt;That code came straight out of the SDK, so I assumed it was correct.
&amp;gt;&amp;gt;&amp;gt;
&amp;gt; 
&amp;gt;&amp;gt;C:\Program Files\ObjectARX 2002\docsamps\comsamps\AsdkPlainComSamp
&amp;gt; 
&amp;gt; 
&amp;gt; It's wrong.  The reason why you can't use GetActiveObject()
&amp;gt; from an in-process client is that it can return any of several
&amp;gt; running instances of AutoCAD, which may not be the one that
&amp;gt; the ARX dll is loaded into.
&amp;gt; 
&amp;gt; Use this function to get a pointer to an IDispatch, that can
&amp;gt; be queried for IAcadApplicatoin:
&amp;gt; 
&amp;gt; extern LPDISPATCH AcadGetIDispatch(bool bAddRef);
&amp;gt; 
&amp;gt; If your link fails, then add an underscore to the front
&amp;gt; of the function name (e.g., _AcadGetIDispatch).
&amp;gt; 
So nice of those Autodesk guys to lead me astray.
The fact that it will work at a "quiet" state I guess is
just luck?
I'll try what you said Tony, being that I dont know COM it may bugger 
me. Maybe some of the C pro's at my work can help me on that.
Thanks
Perry</description>
      <pubDate>Thu, 07 Apr 2005 02:39:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288276#M26905</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-07T02:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288277#M26906</link>
      <description>The same code is there in the 2005 SDK; from samples\com\AsdkPlainComSamp_dg

hr = ::CLSIDFromProgID(L"AutoCAD.Application", &amp;amp;clsid);

if (FAILED(hr))

return;

if(::GetActiveObject(clsid, NULL, &amp;amp;pUnk) != S_OK)

return;

   Dan

"perry" &lt;PERRY_LEETS&gt; wrote in message 
news:42543ba2$1_1@newsprd01...

&amp;gt; Tony Tanzillo wrote:
&amp;gt;&amp;gt;&amp;gt;That code came straight out of the SDK, so I assumed it was correct.
&amp;gt;&amp;gt;
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; Straight out of the SDK?  For what, a standalone COM
&amp;gt;&amp;gt; client?  An in-process ObjectARX COM server?
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; Where exactly did 'that code come straight out of'' ?
&amp;gt;&amp;gt;
&amp;gt; C:\Program Files\ObjectARX 2002\docsamps\comsamps\AsdkPlainComSamp
&amp;gt;
&amp;gt; Yes, I know Im in the "Stone ages" here with 2002.
&amp;gt; Perry&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Thu, 07 Apr 2005 03:01:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288277#M26906</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-07T03:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288278#M26907</link>
      <description>J. Daniel Smith wrote:
&amp;gt; The same code is there in the 2005 SDK; from samples\com\AsdkPlainComSamp_dg
&amp;gt; 
&amp;gt; hr = ::CLSIDFromProgID(L"AutoCAD.Application", &amp;amp;clsid);
&amp;gt; 
&amp;gt; if (FAILED(hr))
&amp;gt; 
&amp;gt; return;
&amp;gt; 
&amp;gt; if(::GetActiveObject(clsid, NULL, &amp;amp;pUnk) != S_OK)
&amp;gt; 
&amp;gt; return;
&amp;gt; 
&amp;gt;    Dan
Are you saying that bad code has propagated to the latest releases of the SDK?
Perry</description>
      <pubDate>Thu, 07 Apr 2005 15:08:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288278#M26907</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-07T15:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: using COM during initilization</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288279#M26908</link>
      <description>Yes, the sample hasn't changed.

The AcadGetIDispatch() function is undocumented,
but the CWinApp::GetIDispatch() is documented but
that requires MFC.

-- 
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"perry" &lt;PERRY_LEETS&gt; wrote in message news:42554d17$1_1@newsprd01...
&amp;gt; J. Daniel Smith wrote:
&amp;gt;&amp;gt; The same code is there in the 2005 SDK; from samples\com\AsdkPlainComSamp_dg
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; hr = ::CLSIDFromProgID(L"AutoCAD.Application", &amp;amp;clsid);
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; if (FAILED(hr))
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; return;
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; if(::GetActiveObject(clsid, NULL, &amp;amp;pUnk) != S_OK)
&amp;gt;&amp;gt;
&amp;gt;&amp;gt; return;
&amp;gt;&amp;gt;
&amp;gt;&amp;gt;    Dan
&amp;gt; Are you saying that bad code has propagated to the latest releases of the SDK?
&amp;gt; Perry&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Thu, 07 Apr 2005 15:24:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/using-com-during-initilization/m-p/1288279#M26908</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-07T15:24:35Z</dc:date>
    </item>
  </channel>
</rss>

