Ivan
2008-07-25 12:58:15 UTC
Exception 'EIntfCastError' with Type library in Delphi 2007
My project contains 1 package (MIPkg) and two executables (MiEx1) and
(MiEx2)
In the executable (MiEx1) i have created a type library (MiEx1.tlb)
Type library MiEx1_TLB.pas:
const
DVCMajorVersion = 1;
DVCMinorVersion = 0;
LIBID_DVC: TGUID = '{4E31D960-4E47-11D2-899A-0000C0C44D2F}';
IID_IAcabadoOLE:TGUID='{4E31D961-4E47-11D2-899A-0000C0C44D2F}';
CLASS_AcabadoOLE:TGUID='{4E31D962-4E47-11D2-899A-0000C0C44D2F}';
type
IAcabadoOLE = interface;
IAcabadoOLEDisp = dispinterface;
.......
implementation
uses ComObj;
class function CoAcabadoOLE.Create: IAcabadoOLE;
begin
Result := CreateComObject(CLASS_AcabadoOLE) as IAcabadoOLE;
end;
In AcabadoOle.pas is at (MiEx1) defines Class TAcabadoOle
TAcabadoOLE = class(TAutoObject, IAcabadoOLE)
In AcabadoOle.pas was added the initialization line
initialization
TAutoObjectFactory.Create(ComServer,TAcabadoOLE,Class_AcabadoOLE,ciMultiInstance,tmApartment);
Note: The "MiEx1_TLB.pas" is compiled in the package (MIPkg)
Operation:
1. Execute (MiEx2)
2. (MiEx2) execute (MiEx1)
3. At the initialize (MiEx1), runs the command TAutoObjectFactory
4. (MiEx2) attempt to create an object of class IAcabadoOle:
var
_Aole: IacabadoOle;
begin
_Aole := CoAcabadoOLE.Create.
....
end;
Failure
When run the line
CreateComObject(CLASS_AcabadoOLE) as IAcabadoOLE
Show Exception error message
Exception 'EIntfCastError' Interface not supported
Thanks.
Ivan.
My project contains 1 package (MIPkg) and two executables (MiEx1) and
(MiEx2)
In the executable (MiEx1) i have created a type library (MiEx1.tlb)
Type library MiEx1_TLB.pas:
const
DVCMajorVersion = 1;
DVCMinorVersion = 0;
LIBID_DVC: TGUID = '{4E31D960-4E47-11D2-899A-0000C0C44D2F}';
IID_IAcabadoOLE:TGUID='{4E31D961-4E47-11D2-899A-0000C0C44D2F}';
CLASS_AcabadoOLE:TGUID='{4E31D962-4E47-11D2-899A-0000C0C44D2F}';
type
IAcabadoOLE = interface;
IAcabadoOLEDisp = dispinterface;
.......
implementation
uses ComObj;
class function CoAcabadoOLE.Create: IAcabadoOLE;
begin
Result := CreateComObject(CLASS_AcabadoOLE) as IAcabadoOLE;
end;
In AcabadoOle.pas is at (MiEx1) defines Class TAcabadoOle
TAcabadoOLE = class(TAutoObject, IAcabadoOLE)
In AcabadoOle.pas was added the initialization line
initialization
TAutoObjectFactory.Create(ComServer,TAcabadoOLE,Class_AcabadoOLE,ciMultiInstance,tmApartment);
Note: The "MiEx1_TLB.pas" is compiled in the package (MIPkg)
Operation:
1. Execute (MiEx2)
2. (MiEx2) execute (MiEx1)
3. At the initialize (MiEx1), runs the command TAutoObjectFactory
4. (MiEx2) attempt to create an object of class IAcabadoOle:
var
_Aole: IacabadoOle;
begin
_Aole := CoAcabadoOLE.Create.
....
end;
Failure
When run the line
CreateComObject(CLASS_AcabadoOLE) as IAcabadoOLE
Show Exception error message
Exception 'EIntfCastError' Interface not supported
Thanks.
Ivan.