Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error creating an activeX instance in a BPL

5 views
Skip to first unread message

Joel Jn-Francois

unread,
Apr 30, 2008, 10:41:30 AM4/30/08
to
When I run the following code in a standalone application inside of a
delphi unit it works perfectly. However, when I take the exact code and
put it in a Bpl that I am writing I get the following a CoInitialize has
not been called, ClassID: {4689781D-6EFD-41BC-950B-E6983890FA5C} error
when the compiler tries to execute the last line <FgennLibrary :=
FgennCore.Libraries[Lib].CreateObject as ILibrary2;>

Can someone tell me what am I doing wrong?


TCircuitGennum=Class(TCircuit)
private

FgennCore : ARK_TLB.TCore2;
FgennLibrary : ARK_TLB.ILibrary2;
Lib : OleVariant;
public

Constructor Create; override;
Destructor Destroy; override;
end;


constructor TCircuitGennum.Create;

Lib := 0;
FgennCore := ARK_TLB.TCore2.Create(nil);
FgennLibrary := FgennCore.Libraries[Lib].CreateObject as ILibrary2;

end;

Yannis

unread,
May 13, 2008, 10:19:42 AM5/13/08
to

Joel Jn-Francois <nore...@emails.com> wrote:
>CoInitialize has not been called

As the message says the CoInitialize procedure that initializes
the COM/OLE engine for the specified application/Thread has not
been cal prior to creating the OLE objects in your application.

The CoInitialize procedure is locate inside the ActiveX unit if my
memory serves me correctly. I would suggest to call it inside your
constructor and do not forget to cal CoUninitialize in your
destructor.

As far as I can remember it is ok to call this procedures as many
times as you like inside a thread/process as long the same number
of call is made to coUninitialize although calling it only once is enough.

Regards
Yannis.

0 new messages