🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.database.win32
2 messages
2 total messages Started by Joel Jn-Francois Wed, 30 Apr 2008 14:41
Error creating an activeX instance in a BPL
#186
Author: Joel Jn-Francois
Date: Wed, 30 Apr 2008 14:41
30 lines
1678 bytes
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;
Re: Error creating an activeX instance in a BPL
#190
Author: Yannis
Date: Tue, 13 May 2008 14:19
19 lines
1587 bytes
Joel Jn-Francois <noreplies@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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads