Board index » delphi » Regular Dll with ActiveX component on a Form gives EOleSysError

Regular Dll with ActiveX component on a Form gives EOleSysError

Hello

Delphi4.0/Win Nt 4.0 sp3

I have a dll that contains an ActiveX component on a form.  I load the Dll
then try to create the form and I am getting a EOleSysErorr.  How do I fix
this?

 

Re:Regular Dll with ActiveX component on a Form gives EOleSysError


Hello

I figured it out.  All that needs to be done was initialize the ole
libraries on the load and Uninitialize on the exit.

Alexander Anguiano
Matrix Computing, Inc.

library DDESourceDLL;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  ShareMem,
  SysUtils,
  Classes,
  ComObj, ActiveX,
  main in 'main.pas',
  AbstractDataSource in '..\..\..\AbstractDataSource.pas',
  AbstractDataSink in '..\..\..\AbstractDataSink.pas',
  PointSource in '..\..\..\PointSource.pas',
  MCObserver in '..\..\..\..\util\MCObserver.pas',
  PlugInInterface in '..\..\..\PlugInInterface.pas',
  util in '..\..\..\..\util\util.pas',
  ddevar in '..\..\..\..\DDEVar\ddevar.pas',
  FMCProperties in '..\..\..\..\util\FMCProperties.pas' {MCProperties},
  FDDESource in 'FDDESource.pas';

{$E spi}
exports
    PlugInVersionInfo, DataSourceFactory,CreateProperties;
var

  SaveExit: Pointer;

procedure LibExit;
begin
  CoUninitialize;  // library exit code
  ExitProc := SaveExit;  // restore exit procedure chain
end;

begin
  CoInitialize(nil); // library initialization code
  SaveExit := ExitProc;  // save exit procedure chain
  ExitProc := @LibExit;  // install LibExit exit procedure
end.

Quote
>Hello

>Delphi4.0/Win Nt 4.0 sp3

>I have a dll that contains an ActiveX component on a form.  I load the Dll
>then try to create the form and I am getting a EOleSysErorr.  How do I fix
>this?

Re:Regular Dll with ActiveX component on a Form gives EOleSysError


Quote
In article <7734rk$fl...@forums.borland.com>, Alexander Anguiano wrote:
> var

>   SaveExit: Pointer;

> procedure LibExit;
> begin
>   CoUninitialize;  // library exit code
>   ExitProc := SaveExit;  // restore exit procedure chain
> end;

> begin
>   CoInitialize(nil); // library initialization code
>   SaveExit := ExitProc;  // save exit procedure chain
>   ExitProc := @LibExit;  // install LibExit exit procedure
> end.

is there some reason you don't use
..
initialization
  CoInitialize(nil);
finalization
  CoUninitialize;
end;

--
Fri, 08 Jan 1999 08:52 EST
Jim O'Brien, UnitOOPS Software   unito...@remove-this-prefix.unitoops.com
Check out our OLE Drag and Drop Components at <http://www.unitoops.com/>
Browse examples online at <http://www.unitoops.com/uoole/examples/>

Re:Regular Dll with ActiveX component on a Form gives EOleSysError


Not there isn't.  I'll try it.

Thanks.

Alexander Anguiano
Matrix Computing, Inc.

Quote
>In article <7734rk$fl...@forums.borland.com>, Alexander Anguiano wrote:
>> var

>>   SaveExit: Pointer;

>> procedure LibExit;
>> begin
>>   CoUninitialize;  // library exit code
>>   ExitProc := SaveExit;  // restore exit procedure chain
>> end;

>> begin
>>   CoInitialize(nil); // library initialization code
>>   SaveExit := ExitProc;  // save exit procedure chain
>>   ExitProc := @LibExit;  // install LibExit exit procedure
>> end.

>is there some reason you don't use
>..
>initialization
>  CoInitialize(nil);
>finalization
>  CoUninitialize;
>end;

>--
>Fri, 08 Jan 1999 08:52 EST
>Jim O'Brien, UnitOOPS Software   unito...@remove-this-prefix.unitoops.com
>Check out our OLE Drag and Drop Components at <http://www.unitoops.com/>
>Browse examples online at <http://www.unitoops.com/uoole/examples/>

Other Threads