On Monday, November 13, 2000 at 2:00:00 AM UTC-6, Shaun Foce wrote:
> Hi,
>
> I wish to create a COM object in Delphi and include the .pas file, which
> contains the class definition and implementation for the COM object, in
> another Delphi project.
>
> My problem is that the TAutoObjectFactory.Create method call in the .pas
> file causes a runtime error #217.
> If I don't include the TAutoObjectFactory.Create method call, then the
> object will not be registered on the machine.
>
> Anybody know what I am doing wrong, or how I can overcome this?
>
> Regards
> Shaun Foce
> Smacsoft Group - Investment Software Solutions
I know this is quite an old post, but for posterity's sake:
I was trying to do the same thing. Specifically I had a .pas file for a COM object that I was trying to unit test. When trying to create an instance in the testrunner I would get a runtime error 217 after TAutoObjectFactory.Create in the unit's initialization section.
It sounds like runtime error 217 means an uhandled exception in a unit's initialization.
From the following post it looks like for TAutoObjectFactory.Create to be successful, the dll or exe must contain a type library.
https://groups.google.com/forum/#!topic/borland.public.delphi.oleautomation/Z-xPhe5B_As
The dll project that originally contained the COM object's .pas had this line
{$R *.TLB}
so I added a similar line to my testrunner that was having the runtime error 217
{$R '..\MyComObject\MyComObject.tlb'}
After including the tlb in the test runner, I was able to create an instance of the com object using the .pas file.