<?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 Addin using Delphi in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761778#M174034</link>
    <description>Has anyone implemented an addin using Delphi ?&lt;BR /&gt;
&lt;BR /&gt;
Could anyone point me at some sample code ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Nick</description>
    <pubDate>Thu, 04 Apr 2002 21:20:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2002-04-04T21:20:21Z</dc:date>
    <item>
      <title>Addin using Delphi</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761778#M174034</link>
      <description>Has anyone implemented an addin using Delphi ?&lt;BR /&gt;
&lt;BR /&gt;
Could anyone point me at some sample code ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Nick</description>
      <pubDate>Thu, 04 Apr 2002 21:20:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761778#M174034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-04T21:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Addin using Delphi</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761779#M174035</link>
      <description>Hi Nick,&lt;BR /&gt;
I am now trying to create an addin since one week but its a hard job and I&lt;BR /&gt;
have the feeling that I will give up soon and programm with VB6.&lt;BR /&gt;
&lt;BR /&gt;
Here the points for Delphi 6 SP1 using IV 5.3 SP1 (all german versions, but&lt;BR /&gt;
it schould work international):&lt;BR /&gt;
&lt;BR /&gt;
- Create an ActiveX Library Projekt&lt;BR /&gt;
- Import the "Autodesk Inventor Object Type Library"&lt;BR /&gt;
and have the first problem: the import is not correct. Look for the&lt;BR /&gt;
Interface:&lt;BR /&gt;
&lt;BR /&gt;
 ApplicationAddInSite = dispinterface&lt;BR /&gt;
    ['{E3571299-DB40-11D2-B783-0060B0F159EF}']&lt;BR /&gt;
    property Type_: ObjectTypeEnum readonly dispid 0;&lt;BR /&gt;
    property Application: Application readonly dispid 50336769;&lt;BR /&gt;
    function CreateCommand(const CommandName: WideString; CommandID:&lt;BR /&gt;
Integer;&lt;BR /&gt;
                           InstallInTools: OleVariant):Command; dispid&lt;BR /&gt;
1610678274;&lt;BR /&gt;
  end;&lt;BR /&gt;
&lt;BR /&gt;
and add the missing line "function CreateCommand.....dispid 1610678274;"&lt;BR /&gt;
&lt;BR /&gt;
I don't know if it is the only mistake, but it is an important.&lt;BR /&gt;
&lt;BR /&gt;
- Now create a new Com-Object and choose in the dialog under "implementing&lt;BR /&gt;
interface" the Interface&lt;BR /&gt;
&lt;BR /&gt;
"_IRxApplicationAddInServer"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Here is the code you have to Add to the new Object:&lt;BR /&gt;
&lt;BR /&gt;
//this is added by the com object wizard&lt;BR /&gt;
type&lt;BR /&gt;
  TTAppAddInServ = class(TAutoObject, _IRxApplicationAddInServer)&lt;BR /&gt;
  protected&lt;BR /&gt;
    function Activate(const AddInSiteObject: ApplicationAddInSite;&lt;BR /&gt;
      FirstTime: WordBool): HResult; stdcall;&lt;BR /&gt;
    function Deactivate: HResult; stdcall;&lt;BR /&gt;
    function ExecuteCommand(CommandID: Integer): HResult; stdcall;&lt;BR /&gt;
    function Get_Automation(out AutomationPtr: AddInAutomation): HResult;&lt;BR /&gt;
      stdcall;&lt;BR /&gt;
    { Protected-Deklarationen }&lt;BR /&gt;
  end;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
var&lt;BR /&gt;
  oInventor : Inventor_TLB.Application;&lt;BR /&gt;
  oCmd1 : Inventor_TLB.Command;&lt;BR /&gt;
&lt;BR /&gt;
implementation&lt;BR /&gt;
&lt;BR /&gt;
uses ComServ;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
function TTAppAddInServ.Activate(const AddInSiteObject:&lt;BR /&gt;
ApplicationAddInSite; FirstTime: WordBool): HResult;&lt;BR /&gt;
begin&lt;BR /&gt;
  //init&lt;BR /&gt;
  AppDefault := InitApplication;&lt;BR /&gt;
  //get the InventorObject&lt;BR /&gt;
  oInventor := AddInSiteObject.Application;&lt;BR /&gt;
&lt;BR /&gt;
  //Create commands&lt;BR /&gt;
  oCmd1 := AddInSiteObject.CreateCommand('My Add In Command',1,True);&lt;BR /&gt;
&lt;BR /&gt;
  Result := S_OK;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
function TTAppAddInServ.Deactivate: HResult;&lt;BR /&gt;
begin&lt;BR /&gt;
  //CleanUp&lt;BR /&gt;
  oInventor := nil;&lt;BR /&gt;
  oCmd1 := nil;&lt;BR /&gt;
  Result := S_OK;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
function TTAppAddInServ.ExecuteCommand(CommandID: Integer): HResult;&lt;BR /&gt;
&lt;BR /&gt;
begin&lt;BR /&gt;
  Case CommandID of&lt;BR /&gt;
    1: begin&lt;BR /&gt;
        //here your Code for your command&lt;BR /&gt;
        end;&lt;BR /&gt;
  end;&lt;BR /&gt;
  Result := S_OK;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
function TTAppAddInServ.Get_Automation(&lt;BR /&gt;
  out AutomationPtr: AddInAutomation): HResult;&lt;BR /&gt;
begin&lt;BR /&gt;
  Result := E_NOINTERFACE;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
//this is added by the com object wizard&lt;BR /&gt;
initialization&lt;BR /&gt;
  TAutoObjectFactory.Create(ComServer, TTAppAddInServ, Class_TAppAddInServ,&lt;BR /&gt;
    ciMultiInstance, tmApartment);&lt;BR /&gt;
end.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
That's the base for an addin. Registering the addin is the same as for VB,&lt;BR /&gt;
shown in the SDK documentation. Use the GUID from the CoClass created by the&lt;BR /&gt;
ActiveX Library Projekt Wizard.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
All other stuff is "normal" COM-programming. To avoid trouble getting the&lt;BR /&gt;
events done, you should use the Event Sink Importer from Binh Ly:&lt;BR /&gt;
http://www.techvanguards.com/   There is also a "TypeExport" which creates a&lt;BR /&gt;
more correct Version of "invetor_TLB.pas".&lt;BR /&gt;
&lt;BR /&gt;
But, as i said, its hard to code. Till now, I don't get the interactive&lt;BR /&gt;
selection part working. Also there is trouble with dynamic string arrays&lt;BR /&gt;
getting via OLEVariant.&lt;BR /&gt;
&lt;BR /&gt;
greetings from berlin, germany&lt;BR /&gt;
Jörgen&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Nick Hall" &lt;NICK.HALL&gt; schrieb im Newsbeitrag&lt;BR /&gt;
news:Xns91E74087BFE4Bnickhallaltasystems@64.124.46.110...&lt;BR /&gt;
&amp;gt; Has anyone implemented an addin using Delphi ?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Could anyone point me at some sample code ?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Nick&lt;/NICK.HALL&gt;</description>
      <pubDate>Fri, 05 Apr 2002 07:56:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761779#M174035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-05T07:56:57Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761780#M174036</link>
      <description>Hi Nick and Jörgen,&lt;BR /&gt;
&lt;BR /&gt;
It *is* possible to create an add-in using Borland tools, but it isn't easy!&lt;BR /&gt;
After fighting the MS Visual C++ compiler (not even close to ANSI compliant)&lt;BR /&gt;
I finally went back to Borland C++ and figured out how to make it work.&lt;BR /&gt;
&lt;BR /&gt;
The issues will be the same, but you will have to translate to Delphi&lt;BR /&gt;
Pascal, I'm not familiar enough with it to tell you exactly how to do it.&lt;BR /&gt;
&lt;BR /&gt;
Now here is the main problem:&lt;BR /&gt;
&lt;BR /&gt;
You want to implement one of two interfaces which Inventor will attempt to&lt;BR /&gt;
call on startup:&lt;BR /&gt;
- "ApplicationAddInServer" (a dispatch interface, primarily for Visual&lt;BR /&gt;
Basic) or&lt;BR /&gt;
- "IRxApplicationAddInServer" (a custom interface).&lt;BR /&gt;
&lt;BR /&gt;
Note that "_IRxApplicationAddInServer" is an internal interface which you&lt;BR /&gt;
are not supposed to use, and it WILL NOT BE CALLED by Inventor on startup,&lt;BR /&gt;
so your code will never run. (In general, you should not use any interfaces&lt;BR /&gt;
that begin with an underscore, as Autodesk makes no commitment to their&lt;BR /&gt;
continuity.)&lt;BR /&gt;
&lt;BR /&gt;
Unfortunately, the Borland inport tool will not offer to let you implement&lt;BR /&gt;
either of those interfaces!  (IRxApplicationAddInServer is a custom&lt;BR /&gt;
interface, so I don't know why it doesn't work, maybe because the&lt;BR /&gt;
"OLEAutomation" flag isn't set.)&lt;BR /&gt;
&lt;BR /&gt;
The work-around is to select "_IRxApplicationAddInServer" as the interface&lt;BR /&gt;
you are implementing, and then manually patch up the code to implement&lt;BR /&gt;
"IRxApplicationAddInServer" instead.&lt;BR /&gt;
&lt;BR /&gt;
- Create an ActiveX Library Project&lt;BR /&gt;
- Import the "Autodesk Inventor Object Type Library"&lt;BR /&gt;
- Now create a new COM Object and choose in the dialog under "implementing&lt;BR /&gt;
interface" the interface "_IRxApplicationAddInServer"&lt;BR /&gt;
&lt;BR /&gt;
To patch up the code, you must do three things:&lt;BR /&gt;
&lt;BR /&gt;
1) The implementation class must inherit from IRxApplicationAddInServer, not&lt;BR /&gt;
_IRxApplicationAddInServer:  I used a global search and replace in the&lt;BR /&gt;
editor.&lt;BR /&gt;
&lt;BR /&gt;
2) The interfaces of the methods Activate, Deactivate, ExecuteCommand, and&lt;BR /&gt;
get_Automation must be changed to match the signatures for the&lt;BR /&gt;
IRxApplicationAddInServer class instead of those for&lt;BR /&gt;
_IRxApplicationAddInServer class.  A file which defines the interfaces&lt;BR /&gt;
should have been created during the import of the type library, in C++ it is&lt;BR /&gt;
named "Inventor_TLB.h"&lt;BR /&gt;
&lt;BR /&gt;
3) Add implementation code for the methods Activate, Deactivate,&lt;BR /&gt;
ExecuteCommand, and get_Automation.&lt;BR /&gt;
&lt;BR /&gt;
This is what it looks like in C++ before and after modification.  I've&lt;BR /&gt;
deleted blocks of code that are not changed.  Also note that Borland C++&lt;BR /&gt;
Builder renames some interfaces during the import to avoid conflicts with&lt;BR /&gt;
Borland VCL classes, in particular the Application class is renamed to&lt;BR /&gt;
"App".&lt;BR /&gt;
&lt;BR /&gt;
Also note (to give credit where it's due) some of the code is copied from&lt;BR /&gt;
the Inventor Application Wizard for Visual C++.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
******************** LrTestAddInImpl.h -- Before Modification&lt;BR /&gt;
**********************************************&lt;BR /&gt;
&lt;BR /&gt;
// LRTESTADDINIMPL.H : Declaration of the TLrTestAddInImpl&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/&lt;BR /&gt;
// TLrTestAddInImpl     Implements _IRxApplicationAddInServer, default&lt;BR /&gt;
interface of LrTestAddIn&lt;BR /&gt;
// ThreadingModel : Apartment&lt;BR /&gt;
// Dual Interface : FALSE&lt;BR /&gt;
// Event Support  : FALSE&lt;BR /&gt;
// Default ProgID : TestInventorAddIn.LrTestAddIn&lt;BR /&gt;
// Description    : Example Code to make an Inventor Add In&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/&lt;BR /&gt;
class ATL_NO_VTABLE TLrTestAddInImpl :&lt;BR /&gt;
  public CComObjectRootEx&lt;CCOMSINGLETHREADMODEL&gt;,&lt;BR /&gt;
  public CComCoClass&lt;TLRTESTADDINIMPL&gt;,&lt;BR /&gt;
  public _IRxApplicationAddInServer&lt;BR /&gt;
{&lt;BR /&gt;
public:&lt;BR /&gt;
  TLrTestAddInImpl() {}&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
&lt;BR /&gt;
BEGIN_COM_MAP(TLrTestAddInImpl)&lt;BR /&gt;
  COM_INTERFACE_ENTRY(_IRxApplicationAddInServer)&lt;BR /&gt;
END_COM_MAP()&lt;BR /&gt;
&lt;BR /&gt;
// _IRxApplicationAddInServer&lt;BR /&gt;
public:&lt;BR /&gt;
&lt;BR /&gt;
  STDMETHOD(Activate(ApplicationAddInSitePtr AddInSiteObject,&lt;BR /&gt;
      TOLEBOOL FirstTime));&lt;BR /&gt;
  STDMETHOD(Deactivate());&lt;BR /&gt;
  STDMETHOD(ExecuteCommand(long CommandID));&lt;BR /&gt;
  STDMETHOD(get_Automation(AddInAutomationPtr* AutomationPtr));&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
#endif //LrTestAddInImplH&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
******************** LrTestAddInImpl.cpp -- Before Modification&lt;BR /&gt;
**********************************************&lt;BR /&gt;
&lt;BR /&gt;
// LRTESTADDINIMPL : Implementation of TLrTestAddInImpl (CoClass:&lt;BR /&gt;
LrTestAddIn, Interface: _IRxApplicationAddInServer)&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::Activate(&lt;BR /&gt;
  ApplicationAddInSitePtr AddInSiteObject, TOLEBOOL FirstTime)&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
  return S_OK;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::Deactivate()&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
  return S_OK;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::ExecuteCommand(long CommandID)&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
  return S_OK;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::get_Automation(&lt;BR /&gt;
  AddInAutomationPtr* AutomationPtr)&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
  return S_OK;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
******************** LrTestAddInImpl.h -- After Modification&lt;BR /&gt;
**********************************************&lt;BR /&gt;
&lt;BR /&gt;
// LRTESTADDINIMPL.H : Declaration of the TLrTestAddInImpl&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/&lt;BR /&gt;
// TLrTestAddInImpl     Implements IRxApplicationAddInServer, default&lt;BR /&gt;
interface of LrTestAddIn&lt;BR /&gt;
// ThreadingModel : Apartment&lt;BR /&gt;
// Dual Interface : FALSE&lt;BR /&gt;
// Event Support  : FALSE&lt;BR /&gt;
// Default ProgID : TestInventorAddIn.LrTestAddIn&lt;BR /&gt;
// Description    : Example Code to make an Inventor Add In&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/&lt;BR /&gt;
class ATL_NO_VTABLE TLrTestAddInImpl :&lt;BR /&gt;
  public CComObjectRootEx&lt;CCOMSINGLETHREADMODEL&gt;,&lt;BR /&gt;
  public CComCoClass&lt;TLRTESTADDINIMPL&gt;,&lt;BR /&gt;
  public IRxApplicationAddInServer&lt;BR /&gt;
//       ^^^^^^^^^^^^^^^^^^^^^^^^^ Inherit from IRxApplicationAddInServer,&lt;BR /&gt;
not _IRxApplicationAddInServer&lt;BR /&gt;
{&lt;BR /&gt;
public:&lt;BR /&gt;
  TLrTestAddInImpl() {}&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
&lt;BR /&gt;
BEGIN_COM_MAP(TLrTestAddInImpl)&lt;BR /&gt;
  COM_INTERFACE_ENTRY(IRxApplicationAddInServer)&lt;BR /&gt;
END_COM_MAP()&lt;BR /&gt;
&lt;BR /&gt;
private:&lt;BR /&gt;
  CComPtr&lt;IRXAPPLICATIONADDINSITE&gt; m_pSite;&lt;BR /&gt;
  CComPtr&lt;APP&gt; m_pApplication;&lt;BR /&gt;
&lt;BR /&gt;
// Definitions of commands here.&lt;BR /&gt;
  CComPtr&lt;COMMAND&gt; m_pCmdTestCommand;&lt;BR /&gt;
&lt;BR /&gt;
// IRxApplicationAddInServer&lt;BR /&gt;
public:&lt;BR /&gt;
&lt;BR /&gt;
// **** Note changed signature in Activate and get_Automation.  Signature&lt;BR /&gt;
copied from Inventor_TLB.h&lt;BR /&gt;
&lt;BR /&gt;
  STDMETHOD(Activate(Inventor_tlb::IRxApplicationAddInSitePtr pAddInSite,&lt;BR /&gt;
Inventor_tlb::BooleanType FirstTime) );&lt;BR /&gt;
  STDMETHOD(Deactivate());&lt;BR /&gt;
  STDMETHOD(ExecuteCommand(long CommandID));&lt;BR /&gt;
  STDMETHOD(get_Automation(LPUNKNOWN* ppUnk));&lt;BR /&gt;
&lt;BR /&gt;
// Return the Rubicon Add-In Site of this object's attachment. (Some useful&lt;BR /&gt;
inline functions)&lt;BR /&gt;
  const CComPtr&lt;IRXAPPLICATIONADDINSITE&gt; Site() const&lt;BR /&gt;
  { return m_pSite; }&lt;BR /&gt;
&lt;BR /&gt;
// Return the Rubicon Application.&lt;BR /&gt;
  const CComPtr&lt;APP&gt; &amp;amp; Application() const&lt;BR /&gt;
  { return m_pApplication; }&lt;BR /&gt;
&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
#endif //LrTestAddInImplH&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
******************** LrTestAddInImpl.cpp -- After Modification&lt;BR /&gt;
**********************************************&lt;BR /&gt;
&lt;BR /&gt;
// LRTESTADDINIMPL : Implementation of TLrTestAddInImpl (CoClass:&lt;BR /&gt;
LrTestAddIn, Interface: IRxApplicationAddInServer)&lt;BR /&gt;
. . . . . .&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::Activate(&lt;BR /&gt;
                     Inventor_tlb::IRxApplicationAddInSitePtr pAddInSite,&lt;BR /&gt;
                     Inventor_tlb::BooleanType FirstTime)&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
    HRESULT Result=NOERROR;&lt;BR /&gt;
    CComPtr&lt;IUNKNOWN&gt; pAppUnk, pCmdUnk;&lt;BR /&gt;
    TVariant vInTools(true);&lt;BR /&gt;
&lt;BR /&gt;
  // Add display names of commands here.&lt;BR /&gt;
    WideString bstrTestCommand("Test Command");&lt;BR /&gt;
&lt;BR /&gt;
  // High-level interfaces supplied directly and implicitly by Inventor to&lt;BR /&gt;
the&lt;BR /&gt;
  // AddIn. These may be held right up until the directive to shutdown&lt;BR /&gt;
(Deactivate) is received.&lt;BR /&gt;
&lt;BR /&gt;
    m_pSite = pAddInSite;&lt;BR /&gt;
&lt;BR /&gt;
    Result = pAddInSite-&amp;gt;get_Application(&amp;amp;pAppUnk);&lt;BR /&gt;
    if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&lt;BR /&gt;
    Result = pAppUnk-&amp;gt;QueryInterface (DIID_App, (void **) &amp;amp;m_pApplication);&lt;BR /&gt;
    if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&lt;BR /&gt;
  // TODO:&lt;BR /&gt;
  // This is where you would place any additional startup code.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
  // Create commands here.&lt;BR /&gt;
  //&lt;BR /&gt;
    Result = pAddInSite-&amp;gt;CreateCommand(bstrTestCommand, 0, vInTools,&lt;BR /&gt;
&amp;amp;pCmdUnk);&lt;BR /&gt;
    if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&lt;BR /&gt;
    Result = pCmdUnk-&amp;gt;QueryInterface (DIID_Command, (void **)&lt;BR /&gt;
&amp;amp;m_pCmdTestCommand);&lt;BR /&gt;
    if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&lt;BR /&gt;
    MessageBox( 0, "Test Command Activated", "Test Add-In", MB_OK );&lt;BR /&gt;
    return Result;&lt;BR /&gt;
&lt;BR /&gt;
  wrapup:&lt;BR /&gt;
    MessageBox( 0, "LrTestAddIn Activated With Errors", "Test Add-In",&lt;BR /&gt;
MB_OK );&lt;BR /&gt;
    return Result;&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::Deactivate()&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
  // Addin wizard destroys commands here&lt;BR /&gt;
    if (m_pCmdTestCommand.p)&lt;BR /&gt;
    {&lt;BR /&gt;
        m_pCmdTestCommand-&amp;gt;Delete();&lt;BR /&gt;
        m_pCmdTestCommand.Release();&lt;BR /&gt;
    }&lt;BR /&gt;
&lt;BR /&gt;
    // Cleanup up of interfaces supplied by Inventor and held on by this&lt;BR /&gt;
AddIn&lt;BR /&gt;
    // at initialization or load.&lt;BR /&gt;
&lt;BR /&gt;
    m_pApplication.Release();&lt;BR /&gt;
    m_pSite.Release();&lt;BR /&gt;
&lt;BR /&gt;
    return NOERROR;&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
  return S_OK;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::ExecuteCommand(long CommandID)&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
     MessageBox( 0, "LrTestAddIn Execute", "Test Add-In", MB_OK );&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
  return S_OK;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
STDMETHODIMP TLrTestAddInImpl::get_Automation(LPUNKNOWN* ppUnk)&lt;BR /&gt;
{&lt;BR /&gt;
  try&lt;BR /&gt;
  {&lt;BR /&gt;
    if (!ppUnk)&lt;BR /&gt;
      return E_INVALIDARG;&lt;BR /&gt;
    *ppUnk = NULL;&lt;BR /&gt;
&lt;BR /&gt;
    return E_NOINTERFACE;&lt;BR /&gt;
  }&lt;BR /&gt;
  catch(Exception &amp;amp;e)&lt;BR /&gt;
  {&lt;BR /&gt;
    return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
  }&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I hope this is enough to get you going.  Good Luck!&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"jpisarz" &lt;JPISARZ&gt; wrote in message&lt;BR /&gt;
news:F5733EC568C0924A777F92CF64F91B03@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Hi Nick,&lt;BR /&gt;
&amp;gt; I am now trying to create an addin since one week but its a hard job and I&lt;BR /&gt;
&amp;gt; have the feeling that I will give up soon and programm with VB6.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Here the points for Delphi 6 SP1 using IV 5.3 SP1 (all german versions,&lt;BR /&gt;
but&lt;BR /&gt;
&amp;gt; it schould work international):&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; - Create an ActiveX Library Projekt&lt;BR /&gt;
&amp;gt; - Import the "Autodesk Inventor Object Type Library"&lt;BR /&gt;
&amp;gt; and have the first problem: the import is not correct. Look for the&lt;BR /&gt;
&amp;gt; Interface:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;  ApplicationAddInSite = dispinterface&lt;BR /&gt;
&amp;gt;     ['{E3571299-DB40-11D2-B783-0060B0F159EF}']&lt;BR /&gt;
&amp;gt;     property Type_: ObjectTypeEnum readonly dispid 0;&lt;BR /&gt;
&amp;gt;     property Application: Application readonly dispid 50336769;&lt;BR /&gt;
&amp;gt;     function CreateCommand(const CommandName: WideString; CommandID:&lt;BR /&gt;
&amp;gt; Integer;&lt;BR /&gt;
&amp;gt;                            InstallInTools: OleVariant):Command; dispid&lt;BR /&gt;
&amp;gt; 1610678274;&lt;BR /&gt;
&amp;gt;   end;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; and add the missing line "function CreateCommand.....dispid 1610678274;"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I don't know if it is the only mistake, but it is an important.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; - Now create a new Com-Object and choose in the dialog under "implementing&lt;BR /&gt;
&amp;gt; interface" the Interface&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "_IRxApplicationAddInServer"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Here is the code you have to Add to the new Object:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; //this is added by the com object wizard&lt;BR /&gt;
&amp;gt; type&lt;BR /&gt;
&amp;gt;   TTAppAddInServ = class(TAutoObject, _IRxApplicationAddInServer)&lt;BR /&gt;
&amp;gt;   protected&lt;BR /&gt;
&amp;gt;     function Activate(const AddInSiteObject: ApplicationAddInSite;&lt;BR /&gt;
&amp;gt;       FirstTime: WordBool): HResult; stdcall;&lt;BR /&gt;
&amp;gt;     function Deactivate: HResult; stdcall;&lt;BR /&gt;
&amp;gt;     function ExecuteCommand(CommandID: Integer): HResult; stdcall;&lt;BR /&gt;
&amp;gt;     function Get_Automation(out AutomationPtr: AddInAutomation): HResult;&lt;BR /&gt;
&amp;gt;       stdcall;&lt;BR /&gt;
&amp;gt;     { Protected-Deklarationen }&lt;BR /&gt;
&amp;gt;   end;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; var&lt;BR /&gt;
&amp;gt;   oInventor : Inventor_TLB.Application;&lt;BR /&gt;
&amp;gt;   oCmd1 : Inventor_TLB.Command;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; implementation&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; uses ComServ;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; function TTAppAddInServ.Activate(const AddInSiteObject:&lt;BR /&gt;
&amp;gt; ApplicationAddInSite; FirstTime: WordBool): HResult;&lt;BR /&gt;
&amp;gt; begin&lt;BR /&gt;
&amp;gt;   //init&lt;BR /&gt;
&amp;gt;   AppDefault := InitApplication;&lt;BR /&gt;
&amp;gt;   //get the InventorObject&lt;BR /&gt;
&amp;gt;   oInventor := AddInSiteObject.Application;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   //Create commands&lt;BR /&gt;
&amp;gt;   oCmd1 := AddInSiteObject.CreateCommand('My Add In Command',1,True);&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   Result := S_OK;&lt;BR /&gt;
&amp;gt; end;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; function TTAppAddInServ.Deactivate: HResult;&lt;BR /&gt;
&amp;gt; begin&lt;BR /&gt;
&amp;gt;   //CleanUp&lt;BR /&gt;
&amp;gt;   oInventor := nil;&lt;BR /&gt;
&amp;gt;   oCmd1 := nil;&lt;BR /&gt;
&amp;gt;   Result := S_OK;&lt;BR /&gt;
&amp;gt; end;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; function TTAppAddInServ.ExecuteCommand(CommandID: Integer): HResult;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; begin&lt;BR /&gt;
&amp;gt;   Case CommandID of&lt;BR /&gt;
&amp;gt;     1: begin&lt;BR /&gt;
&amp;gt;         //here your Code for your command&lt;BR /&gt;
&amp;gt;         end;&lt;BR /&gt;
&amp;gt;   end;&lt;BR /&gt;
&amp;gt;   Result := S_OK;&lt;BR /&gt;
&amp;gt; end;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; function TTAppAddInServ.Get_Automation(&lt;BR /&gt;
&amp;gt;   out AutomationPtr: AddInAutomation): HResult;&lt;BR /&gt;
&amp;gt; begin&lt;BR /&gt;
&amp;gt;   Result := E_NOINTERFACE;&lt;BR /&gt;
&amp;gt; end;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; //this is added by the com object wizard&lt;BR /&gt;
&amp;gt; initialization&lt;BR /&gt;
&amp;gt;   TAutoObjectFactory.Create(ComServer, TTAppAddInServ,&lt;BR /&gt;
Class_TAppAddInServ,&lt;BR /&gt;
&amp;gt;     ciMultiInstance, tmApartment);&lt;BR /&gt;
&amp;gt; end.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; That's the base for an addin. Registering the addin is the same as for VB,&lt;BR /&gt;
&amp;gt; shown in the SDK documentation. Use the GUID from the CoClass created by&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; ActiveX Library Projekt Wizard.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; All other stuff is "normal" COM-programming. To avoid trouble getting the&lt;BR /&gt;
&amp;gt; events done, you should use the Event Sink Importer from Binh Ly:&lt;BR /&gt;
&amp;gt; http://www.techvanguards.com/   There is also a "TypeExport" which creates&lt;BR /&gt;
a&lt;BR /&gt;
&amp;gt; more correct Version of "invetor_TLB.pas".&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; But, as i said, its hard to code. Till now, I don't get the interactive&lt;BR /&gt;
&amp;gt; selection part working. Also there is trouble with dynamic string arrays&lt;BR /&gt;
&amp;gt; getting via OLEVariant.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; greetings from berlin, germany&lt;BR /&gt;
&amp;gt; Jörgen&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Nick Hall" &lt;NICK.HALL&gt; schrieb im Newsbeitrag&lt;BR /&gt;
&amp;gt; news:Xns91E74087BFE4Bnickhallaltasystems@64.124.46.110...&lt;BR /&gt;
&amp;gt; &amp;gt; Has anyone implemented an addin using Delphi ?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Could anyone point me at some sample code ?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Thanks&lt;BR /&gt;
&amp;gt; &amp;gt; Nick&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/NICK.HALL&gt;&lt;/JPISARZ&gt;&lt;/IUNKNOWN&gt;&lt;/APP&gt;&lt;/IRXAPPLICATIONADDINSITE&gt;&lt;/COMMAND&gt;&lt;/APP&gt;&lt;/IRXAPPLICATIONADDINSITE&gt;&lt;/TLRTESTADDINIMPL&gt;&lt;/CCOMSINGLETHREADMODEL&gt;&lt;/TLRTESTADDINIMPL&gt;&lt;/CCOMSINGLETHREADMODEL&gt;</description>
      <pubDate>Mon, 08 Apr 2002 18:41:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761780#M174036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-08T18:41:02Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761781#M174037</link>
      <description>Hi Larry,&lt;BR /&gt;
&lt;BR /&gt;
You are right, using the "_IRx" Interfaces is not recommend by autodesk, I&lt;BR /&gt;
read this a few days ago.&lt;BR /&gt;
But the interface IS CALLED on startup, the code I'm using works.&lt;BR /&gt;
&lt;BR /&gt;
The Problem for Delphi is, that it is much easier to use the dispatch&lt;BR /&gt;
interface instead the custom interface. And the "_IRxApplicationAddInServer"&lt;BR /&gt;
delivers a dispinterface for the InSiteObject.&lt;BR /&gt;
&lt;BR /&gt;
COM Programming under Delphi is tricky. There are a lot of good wizards&lt;BR /&gt;
producing easy code and work in background so for normal OLE Automation it&lt;BR /&gt;
is very simple (i.e. using the Apprentice Server is as easy as using a&lt;BR /&gt;
visual component). Leaving this way (and this is what happend for producing&lt;BR /&gt;
add-ins) will the delphi-programmer kick in the real COM-world. And this is&lt;BR /&gt;
a very different world.&lt;BR /&gt;
&lt;BR /&gt;
After working 2 weeks on a program in Delphi (still problems with&lt;BR /&gt;
interactive selection) I realized the same program in Visual Basic in one&lt;BR /&gt;
day (working).&lt;BR /&gt;
&lt;BR /&gt;
Yes, it *is* possible to create an add-in using Delphi, but only for people&lt;BR /&gt;
with (a lot) experience in COM-programming.&lt;BR /&gt;
&lt;BR /&gt;
I will use VB in future for add-ins and Delphi for apprentice server&lt;BR /&gt;
applications. This is my personal "best time and money" solution.&lt;BR /&gt;
&lt;BR /&gt;
greetings Jörgen&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Larry Robinson" &lt;SILVER-DAD&gt; schrieb im Newsbeitrag&lt;BR /&gt;
news:652094C5289EF4E966742A0E4B303B3B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Hi Nick and Jörgen,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; It *is* possible to create an add-in using Borland tools, but it isn't&lt;BR /&gt;
easy!&lt;BR /&gt;
&amp;gt; After fighting the MS Visual C++ compiler (not even close to ANSI&lt;BR /&gt;
compliant)&lt;BR /&gt;
&amp;gt; I finally went back to Borland C++ and figured out how to make it work.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The issues will be the same, but you will have to translate to Delphi&lt;BR /&gt;
&amp;gt; Pascal, I'm not familiar enough with it to tell you exactly how to do it.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Now here is the main problem:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; You want to implement one of two interfaces which Inventor will attempt to&lt;BR /&gt;
&amp;gt; call on startup:&lt;BR /&gt;
&amp;gt; - "ApplicationAddInServer" (a dispatch interface, primarily for Visual&lt;BR /&gt;
&amp;gt; Basic) or&lt;BR /&gt;
&amp;gt; - "IRxApplicationAddInServer" (a custom interface).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Note that "_IRxApplicationAddInServer" is an internal interface which you&lt;BR /&gt;
&amp;gt; are not supposed to use, and it WILL NOT BE CALLED by Inventor on startup,&lt;BR /&gt;
&amp;gt; so your code will never run. (In general, you should not use any&lt;BR /&gt;
interfaces&lt;BR /&gt;
&amp;gt; that begin with an underscore, as Autodesk makes no commitment to their&lt;BR /&gt;
&amp;gt; continuity.)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Unfortunately, the Borland inport tool will not offer to let you implement&lt;BR /&gt;
&amp;gt; either of those interfaces!  (IRxApplicationAddInServer is a custom&lt;BR /&gt;
&amp;gt; interface, so I don't know why it doesn't work, maybe because the&lt;BR /&gt;
&amp;gt; "OLEAutomation" flag isn't set.)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The work-around is to select "_IRxApplicationAddInServer" as the interface&lt;BR /&gt;
&amp;gt; you are implementing, and then manually patch up the code to implement&lt;BR /&gt;
&amp;gt; "IRxApplicationAddInServer" instead.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; - Create an ActiveX Library Project&lt;BR /&gt;
&amp;gt; - Import the "Autodesk Inventor Object Type Library"&lt;BR /&gt;
&amp;gt; - Now create a new COM Object and choose in the dialog under "implementing&lt;BR /&gt;
&amp;gt; interface" the interface "_IRxApplicationAddInServer"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; To patch up the code, you must do three things:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 1) The implementation class must inherit from IRxApplicationAddInServer,&lt;BR /&gt;
not&lt;BR /&gt;
&amp;gt; _IRxApplicationAddInServer:  I used a global search and replace in the&lt;BR /&gt;
&amp;gt; editor.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 2) The interfaces of the methods Activate, Deactivate, ExecuteCommand, and&lt;BR /&gt;
&amp;gt; get_Automation must be changed to match the signatures for the&lt;BR /&gt;
&amp;gt; IRxApplicationAddInServer class instead of those for&lt;BR /&gt;
&amp;gt; _IRxApplicationAddInServer class.  A file which defines the interfaces&lt;BR /&gt;
&amp;gt; should have been created during the import of the type library, in C++ it&lt;BR /&gt;
is&lt;BR /&gt;
&amp;gt; named "Inventor_TLB.h"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 3) Add implementation code for the methods Activate, Deactivate,&lt;BR /&gt;
&amp;gt; ExecuteCommand, and get_Automation.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; This is what it looks like in C++ before and after modification.  I've&lt;BR /&gt;
&amp;gt; deleted blocks of code that are not changed.  Also note that Borland C++&lt;BR /&gt;
&amp;gt; Builder renames some interfaces during the import to avoid conflicts with&lt;BR /&gt;
&amp;gt; Borland VCL classes, in particular the Application class is renamed to&lt;BR /&gt;
&amp;gt; "App".&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Also note (to give credit where it's due) some of the code is copied from&lt;BR /&gt;
&amp;gt; the Inventor Application Wizard for Visual C++.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ******************** LrTestAddInImpl.h -- Before Modification&lt;BR /&gt;
&amp;gt; **********************************************&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // LRTESTADDINIMPL.H : Declaration of the TLrTestAddInImpl&lt;BR /&gt;
&amp;gt; . . . . . .&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
&amp;gt; /&lt;BR /&gt;
&amp;gt; // TLrTestAddInImpl     Implements _IRxApplicationAddInServer, default&lt;BR /&gt;
&amp;gt; interface of LrTestAddIn&lt;BR /&gt;
&amp;gt; // ThreadingModel : Apartment&lt;BR /&gt;
&amp;gt; // Dual Interface : FALSE&lt;BR /&gt;
&amp;gt; // Event Support  : FALSE&lt;BR /&gt;
&amp;gt; // Default ProgID : TestInventorAddIn.LrTestAddIn&lt;BR /&gt;
&amp;gt; // Description    : Example Code to make an Inventor Add In&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
&amp;gt; /&lt;BR /&gt;
&amp;gt; class ATL_NO_VTABLE TLrTestAddInImpl :&lt;BR /&gt;
&amp;gt;   public CComObjectRootEx&lt;CCOMSINGLETHREADMODEL&gt;,&lt;BR /&gt;
&amp;gt;   public CComCoClass&lt;TLRTESTADDINIMPL&gt;,&lt;BR /&gt;
&amp;gt;   public _IRxApplicationAddInServer&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; public:&lt;BR /&gt;
&amp;gt;   TLrTestAddInImpl() {}&lt;BR /&gt;
&amp;gt; . . . . . .&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; BEGIN_COM_MAP(TLrTestAddInImpl)&lt;BR /&gt;
&amp;gt;   COM_INTERFACE_ENTRY(_IRxApplicationAddInServer)&lt;BR /&gt;
&amp;gt; END_COM_MAP()&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // _IRxApplicationAddInServer&lt;BR /&gt;
&amp;gt; public:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   STDMETHOD(Activate(ApplicationAddInSitePtr AddInSiteObject,&lt;BR /&gt;
&amp;gt;       TOLEBOOL FirstTime));&lt;BR /&gt;
&amp;gt;   STDMETHOD(Deactivate());&lt;BR /&gt;
&amp;gt;   STDMETHOD(ExecuteCommand(long CommandID));&lt;BR /&gt;
&amp;gt;   STDMETHOD(get_Automation(AddInAutomationPtr* AutomationPtr));&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; #endif //LrTestAddInImplH&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ******************** LrTestAddInImpl.cpp -- Before Modification&lt;BR /&gt;
&amp;gt; **********************************************&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // LRTESTADDINIMPL : Implementation of TLrTestAddInImpl (CoClass:&lt;BR /&gt;
&amp;gt; LrTestAddIn, Interface: _IRxApplicationAddInServer)&lt;BR /&gt;
&amp;gt; . . . . . .&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::Activate(&lt;BR /&gt;
&amp;gt;   ApplicationAddInSitePtr AddInSiteObject, TOLEBOOL FirstTime)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   return S_OK;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::Deactivate()&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   return S_OK;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::ExecuteCommand(long CommandID)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   return S_OK;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::get_Automation(&lt;BR /&gt;
&amp;gt;   AddInAutomationPtr* AutomationPtr)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID__IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   return S_OK;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ******************** LrTestAddInImpl.h -- After Modification&lt;BR /&gt;
&amp;gt; **********************************************&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // LRTESTADDINIMPL.H : Declaration of the TLrTestAddInImpl&lt;BR /&gt;
&amp;gt; . . . . . .&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
&amp;gt; /&lt;BR /&gt;
&amp;gt; // TLrTestAddInImpl     Implements IRxApplicationAddInServer, default&lt;BR /&gt;
&amp;gt; interface of LrTestAddIn&lt;BR /&gt;
&amp;gt; // ThreadingModel : Apartment&lt;BR /&gt;
&amp;gt; // Dual Interface : FALSE&lt;BR /&gt;
&amp;gt; // Event Support  : FALSE&lt;BR /&gt;
&amp;gt; // Default ProgID : TestInventorAddIn.LrTestAddIn&lt;BR /&gt;
&amp;gt; // Description    : Example Code to make an Inventor Add In&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
&amp;gt; /&lt;BR /&gt;
&amp;gt; class ATL_NO_VTABLE TLrTestAddInImpl :&lt;BR /&gt;
&amp;gt;   public CComObjectRootEx&lt;CCOMSINGLETHREADMODEL&gt;,&lt;BR /&gt;
&amp;gt;   public CComCoClass&lt;TLRTESTADDINIMPL&gt;,&lt;BR /&gt;
&amp;gt;   public IRxApplicationAddInServer&lt;BR /&gt;
&amp;gt; //       ^^^^^^^^^^^^^^^^^^^^^^^^^ Inherit from IRxApplicationAddInServer,&lt;BR /&gt;
&amp;gt; not _IRxApplicationAddInServer&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; public:&lt;BR /&gt;
&amp;gt;   TLrTestAddInImpl() {}&lt;BR /&gt;
&amp;gt; . . . . . .&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; BEGIN_COM_MAP(TLrTestAddInImpl)&lt;BR /&gt;
&amp;gt;   COM_INTERFACE_ENTRY(IRxApplicationAddInServer)&lt;BR /&gt;
&amp;gt; END_COM_MAP()&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; private:&lt;BR /&gt;
&amp;gt;   CComPtr&lt;IRXAPPLICATIONADDINSITE&gt; m_pSite;&lt;BR /&gt;
&amp;gt;   CComPtr&lt;APP&gt; m_pApplication;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // Definitions of commands here.&lt;BR /&gt;
&amp;gt;   CComPtr&lt;COMMAND&gt; m_pCmdTestCommand;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // IRxApplicationAddInServer&lt;BR /&gt;
&amp;gt; public:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // **** Note changed signature in Activate and get_Automation.  Signature&lt;BR /&gt;
&amp;gt; copied from Inventor_TLB.h&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   STDMETHOD(Activate(Inventor_tlb::IRxApplicationAddInSitePtr pAddInSite,&lt;BR /&gt;
&amp;gt; Inventor_tlb::BooleanType FirstTime) );&lt;BR /&gt;
&amp;gt;   STDMETHOD(Deactivate());&lt;BR /&gt;
&amp;gt;   STDMETHOD(ExecuteCommand(long CommandID));&lt;BR /&gt;
&amp;gt;   STDMETHOD(get_Automation(LPUNKNOWN* ppUnk));&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // Return the Rubicon Add-In Site of this object's attachment. (Some&lt;BR /&gt;
useful&lt;BR /&gt;
&amp;gt; inline functions)&lt;BR /&gt;
&amp;gt;   const CComPtr&lt;IRXAPPLICATIONADDINSITE&gt; Site() const&lt;BR /&gt;
&amp;gt;   { return m_pSite; }&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // Return the Rubicon Application.&lt;BR /&gt;
&amp;gt;   const CComPtr&lt;APP&gt; &amp;amp; Application() const&lt;BR /&gt;
&amp;gt;   { return m_pApplication; }&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; #endif //LrTestAddInImplH&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ******************** LrTestAddInImpl.cpp -- After Modification&lt;BR /&gt;
&amp;gt; **********************************************&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; // LRTESTADDINIMPL : Implementation of TLrTestAddInImpl (CoClass:&lt;BR /&gt;
&amp;gt; LrTestAddIn, Interface: IRxApplicationAddInServer)&lt;BR /&gt;
&amp;gt; . . . . . .&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::Activate(&lt;BR /&gt;
&amp;gt;                      Inventor_tlb::IRxApplicationAddInSitePtr pAddInSite,&lt;BR /&gt;
&amp;gt;                      Inventor_tlb::BooleanType FirstTime)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     HRESULT Result=NOERROR;&lt;BR /&gt;
&amp;gt;     CComPtr&lt;IUNKNOWN&gt; pAppUnk, pCmdUnk;&lt;BR /&gt;
&amp;gt;     TVariant vInTools(true);&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   // Add display names of commands here.&lt;BR /&gt;
&amp;gt;     WideString bstrTestCommand("Test Command");&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   // High-level interfaces supplied directly and implicitly by Inventor to&lt;BR /&gt;
&amp;gt; the&lt;BR /&gt;
&amp;gt;   // AddIn. These may be held right up until the directive to shutdown&lt;BR /&gt;
&amp;gt; (Deactivate) is received.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     m_pSite = pAddInSite;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Result = pAddInSite-&amp;gt;get_Application(&amp;amp;pAppUnk);&lt;BR /&gt;
&amp;gt;     if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Result = pAppUnk-&amp;gt;QueryInterface (DIID_App, (void **)&lt;BR /&gt;
&amp;amp;m_pApplication);&lt;BR /&gt;
&amp;gt;     if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   // TODO:&lt;BR /&gt;
&amp;gt;   // This is where you would place any additional startup code.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   // Create commands here.&lt;BR /&gt;
&amp;gt;   //&lt;BR /&gt;
&amp;gt;     Result = pAddInSite-&amp;gt;CreateCommand(bstrTestCommand, 0, vInTools,&lt;BR /&gt;
&amp;gt; &amp;amp;pCmdUnk);&lt;BR /&gt;
&amp;gt;     if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Result = pCmdUnk-&amp;gt;QueryInterface (DIID_Command, (void **)&lt;BR /&gt;
&amp;gt; &amp;amp;m_pCmdTestCommand);&lt;BR /&gt;
&amp;gt;     if( FAILED( Result ) ) goto wrapup;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     MessageBox( 0, "Test Command Activated", "Test Add-In", MB_OK );&lt;BR /&gt;
&amp;gt;     return Result;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;   wrapup:&lt;BR /&gt;
&amp;gt;     MessageBox( 0, "LrTestAddIn Activated With Errors", "Test Add-In",&lt;BR /&gt;
&amp;gt; MB_OK );&lt;BR /&gt;
&amp;gt;     return Result;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::Deactivate()&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;   // Addin wizard destroys commands here&lt;BR /&gt;
&amp;gt;     if (m_pCmdTestCommand.p)&lt;BR /&gt;
&amp;gt;     {&lt;BR /&gt;
&amp;gt;         m_pCmdTestCommand-&amp;gt;Delete();&lt;BR /&gt;
&amp;gt;         m_pCmdTestCommand.Release();&lt;BR /&gt;
&amp;gt;     }&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     // Cleanup up of interfaces supplied by Inventor and held on by this&lt;BR /&gt;
&amp;gt; AddIn&lt;BR /&gt;
&amp;gt;     // at initialization or load.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     m_pApplication.Release();&lt;BR /&gt;
&amp;gt;     m_pSite.Release();&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     return NOERROR;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   return S_OK;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::ExecuteCommand(long CommandID)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;      MessageBox( 0, "LrTestAddIn Execute", "Test Add-In", MB_OK );&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   return S_OK;&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; STDMETHODIMP TLrTestAddInImpl::get_Automation(LPUNKNOWN* ppUnk)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt;   try&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     if (!ppUnk)&lt;BR /&gt;
&amp;gt;       return E_INVALIDARG;&lt;BR /&gt;
&amp;gt;     *ppUnk = NULL;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     return E_NOINTERFACE;&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt;   catch(Exception &amp;amp;e)&lt;BR /&gt;
&amp;gt;   {&lt;BR /&gt;
&amp;gt;     return Error(e.Message.c_str(), IID_IRxApplicationAddInServer);&lt;BR /&gt;
&amp;gt;   }&lt;BR /&gt;
&amp;gt; };&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I hope this is enough to get you going.  Good Luck!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "jpisarz" &lt;JPISARZ&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:F5733EC568C0924A777F92CF64F91B03@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; Hi Nick,&lt;BR /&gt;
&amp;gt; &amp;gt; I am now trying to create an addin since one week but its a hard job and&lt;BR /&gt;
I&lt;BR /&gt;
&amp;gt; &amp;gt; have the feeling that I will give up soon and programm with VB6.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Here the points for Delphi 6 SP1 using IV 5.3 SP1 (all german versions,&lt;BR /&gt;
&amp;gt; but&lt;BR /&gt;
&amp;gt; &amp;gt; it schould work international):&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; - Create an ActiveX Library Projekt&lt;BR /&gt;
&amp;gt; &amp;gt; - Import the "Autodesk Inventor Object Type Library"&lt;BR /&gt;
&amp;gt; &amp;gt; and have the first problem: the import is not correct. Look for the&lt;BR /&gt;
&amp;gt; &amp;gt; Interface:&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;  ApplicationAddInSite = dispinterface&lt;BR /&gt;
&amp;gt; &amp;gt;     ['{E3571299-DB40-11D2-B783-0060B0F159EF}']&lt;BR /&gt;
&amp;gt; &amp;gt;     property Type_: ObjectTypeEnum readonly dispid 0;&lt;BR /&gt;
&amp;gt; &amp;gt;     property Application: Application readonly dispid 50336769;&lt;BR /&gt;
&amp;gt; &amp;gt;     function CreateCommand(const CommandName: WideString; CommandID:&lt;BR /&gt;
&amp;gt; &amp;gt; Integer;&lt;BR /&gt;
&amp;gt; &amp;gt;                            InstallInTools: OleVariant):Command; dispid&lt;BR /&gt;
&amp;gt; &amp;gt; 1610678274;&lt;BR /&gt;
&amp;gt; &amp;gt;   end;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; and add the missing line "function CreateCommand.....dispid 1610678274;"&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; I don't know if it is the only mistake, but it is an important.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; - Now create a new Com-Object and choose in the dialog under&lt;BR /&gt;
"implementing&lt;BR /&gt;
&amp;gt; &amp;gt; interface" the Interface&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; "_IRxApplicationAddInServer"&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Here is the code you have to Add to the new Object:&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; //this is added by the com object wizard&lt;BR /&gt;
&amp;gt; &amp;gt; type&lt;BR /&gt;
&amp;gt; &amp;gt;   TTAppAddInServ = class(TAutoObject, _IRxApplicationAddInServer)&lt;BR /&gt;
&amp;gt; &amp;gt;   protected&lt;BR /&gt;
&amp;gt; &amp;gt;     function Activate(const AddInSiteObject: ApplicationAddInSite;&lt;BR /&gt;
&amp;gt; &amp;gt;       FirstTime: WordBool): HResult; stdcall;&lt;BR /&gt;
&amp;gt; &amp;gt;     function Deactivate: HResult; stdcall;&lt;BR /&gt;
&amp;gt; &amp;gt;     function ExecuteCommand(CommandID: Integer): HResult; stdcall;&lt;BR /&gt;
&amp;gt; &amp;gt;     function Get_Automation(out AutomationPtr: AddInAutomation):&lt;BR /&gt;
HResult;&lt;BR /&gt;
&amp;gt; &amp;gt;       stdcall;&lt;BR /&gt;
&amp;gt; &amp;gt;     { Protected-Deklarationen }&lt;BR /&gt;
&amp;gt; &amp;gt;   end;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; var&lt;BR /&gt;
&amp;gt; &amp;gt;   oInventor : Inventor_TLB.Application;&lt;BR /&gt;
&amp;gt; &amp;gt;   oCmd1 : Inventor_TLB.Command;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; implementation&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; uses ComServ;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; function TTAppAddInServ.Activate(const AddInSiteObject:&lt;BR /&gt;
&amp;gt; &amp;gt; ApplicationAddInSite; FirstTime: WordBool): HResult;&lt;BR /&gt;
&amp;gt; &amp;gt; begin&lt;BR /&gt;
&amp;gt; &amp;gt;   //init&lt;BR /&gt;
&amp;gt; &amp;gt;   AppDefault := InitApplication;&lt;BR /&gt;
&amp;gt; &amp;gt;   //get the InventorObject&lt;BR /&gt;
&amp;gt; &amp;gt;   oInventor := AddInSiteObject.Application;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;   //Create commands&lt;BR /&gt;
&amp;gt; &amp;gt;   oCmd1 := AddInSiteObject.CreateCommand('My Add In Command',1,True);&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;   Result := S_OK;&lt;BR /&gt;
&amp;gt; &amp;gt; end;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; function TTAppAddInServ.Deactivate: HResult;&lt;BR /&gt;
&amp;gt; &amp;gt; begin&lt;BR /&gt;
&amp;gt; &amp;gt;   //CleanUp&lt;BR /&gt;
&amp;gt; &amp;gt;   oInventor := nil;&lt;BR /&gt;
&amp;gt; &amp;gt;   oCmd1 := nil;&lt;BR /&gt;
&amp;gt; &amp;gt;   Result := S_OK;&lt;BR /&gt;
&amp;gt; &amp;gt; end;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; function TTAppAddInServ.ExecuteCommand(CommandID: Integer): HResult;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; begin&lt;BR /&gt;
&amp;gt; &amp;gt;   Case CommandID of&lt;BR /&gt;
&amp;gt; &amp;gt;     1: begin&lt;BR /&gt;
&amp;gt; &amp;gt;         //here your Code for your command&lt;BR /&gt;
&amp;gt; &amp;gt;         end;&lt;BR /&gt;
&amp;gt; &amp;gt;   end;&lt;BR /&gt;
&amp;gt; &amp;gt;   Result := S_OK;&lt;BR /&gt;
&amp;gt; &amp;gt; end;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; function TTAppAddInServ.Get_Automation(&lt;BR /&gt;
&amp;gt; &amp;gt;   out AutomationPtr: AddInAutomation): HResult;&lt;BR /&gt;
&amp;gt; &amp;gt; begin&lt;BR /&gt;
&amp;gt; &amp;gt;   Result := E_NOINTERFACE;&lt;BR /&gt;
&amp;gt; &amp;gt; end;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; //this is added by the com object wizard&lt;BR /&gt;
&amp;gt; &amp;gt; initialization&lt;BR /&gt;
&amp;gt; &amp;gt;   TAutoObjectFactory.Create(ComServer, TTAppAddInServ,&lt;BR /&gt;
&amp;gt; Class_TAppAddInServ,&lt;BR /&gt;
&amp;gt; &amp;gt;     ciMultiInstance, tmApartment);&lt;BR /&gt;
&amp;gt; &amp;gt; end.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; That's the base for an addin. Registering the addin is the same as for&lt;BR /&gt;
VB,&lt;BR /&gt;
&amp;gt; &amp;gt; shown in the SDK documentation. Use the GUID from the CoClass created by&lt;BR /&gt;
&amp;gt; the&lt;BR /&gt;
&amp;gt; &amp;gt; ActiveX Library Projekt Wizard.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; All other stuff is "normal" COM-programming. To avoid trouble getting&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; &amp;gt; events done, you should use the Event Sink Importer from Binh Ly:&lt;BR /&gt;
&amp;gt; &amp;gt; http://www.techvanguards.com/   There is also a "TypeExport" which&lt;BR /&gt;
creates&lt;BR /&gt;
&amp;gt; a&lt;BR /&gt;
&amp;gt; &amp;gt; more correct Version of "invetor_TLB.pas".&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; But, as i said, its hard to code. Till now, I don't get the interactive&lt;BR /&gt;
&amp;gt; &amp;gt; selection part working. Also there is trouble with dynamic string arrays&lt;BR /&gt;
&amp;gt; &amp;gt; getting via OLEVariant.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; greetings from berlin, germany&lt;BR /&gt;
&amp;gt; &amp;gt; Jörgen&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; "Nick Hall" &lt;NICK.HALL&gt; schrieb im Newsbeitrag&lt;BR /&gt;
&amp;gt; &amp;gt; news:Xns91E74087BFE4Bnickhallaltasystems@64.124.46.110...&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Has anyone implemented an addin using Delphi ?&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Could anyone point me at some sample code ?&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Thanks&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Nick&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/NICK.HALL&gt;&lt;/JPISARZ&gt;&lt;/IUNKNOWN&gt;&lt;/APP&gt;&lt;/IRXAPPLICATIONADDINSITE&gt;&lt;/COMMAND&gt;&lt;/APP&gt;&lt;/IRXAPPLICATIONADDINSITE&gt;&lt;/TLRTESTADDINIMPL&gt;&lt;/CCOMSINGLETHREADMODEL&gt;&lt;/TLRTESTADDINIMPL&gt;&lt;/CCOMSINGLETHREADMODEL&gt;&lt;/SILVER-DAD&gt;</description>
      <pubDate>Tue, 09 Apr 2002 03:08:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761781#M174037</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-09T03:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Addin using Delphi</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761782#M174038</link>
      <description>I struggled to make it work for a while, and gave up.&lt;BR /&gt;
&lt;BR /&gt;
I believe that Autodesk could (and should) create a simple Delphi component that works, and make it available for download.  I don't think it would take more than a couple day's effort by some programmer from Autodesk.&lt;BR /&gt;
&lt;BR /&gt;
I find Delphi superior to VB in many ways, and would really like to use it for Inventor programming.  However, it seems that Autodesk is committed to Microsoft, so I doubt that they would put in the effort.  Can you prove me wrong, Autodesk?&lt;BR /&gt;
&lt;BR /&gt;
Murray</description>
      <pubDate>Wed, 15 May 2002 11:40:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/addin-using-delphi/m-p/761782#M174038</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-05-15T11:40:58Z</dc:date>
    </item>
  </channel>
</rss>

