Board index » delphi » Re-implementing existing interface using TLB editor?

Re-implementing existing interface using TLB editor?

Hi everyone, I have a problem of which I don't know where to start.
I have developed a active-X DLL that implements a certain interface,
let's call it iFileInfo. I registered the DLL and it works fine.

Now I would like to create a new active-x DLL that re-implements
the same interface for a different file type but with a perfectly identical
iFiletype interface. iFileinfo will have many different implementations in
the future, but the interface won't change.

How do I do this, preferably using the TLB editor? Is it possible at all?
How do I insert the "old" declaration into the new TLB?

Another problem:  if I want to create a method in a certain
interface that needs another interface as a parameter,
the TLB editor only offers me iUnknown etc. as parameter types
in the combobox. How can I enter my own "iFileinfo" as a
parameter type, or must I do an explicit typecast to iUnknown?

--
Arthur Hoornweg
(To answer me, please remove the ".net" from my e-mail address)

 

Re:Re-implementing existing interface using TLB editor?


If you want to implement the same IInterface1 in 2 objects and a different
implementation for IInterface2 you will need to:
1) Create an ancestor
2) use the implements keyword to aggregate the objects.

My choice would be with solution number 1. You will need to declare all the
"different implentation method" as virtual and safecall (or stdcall).

In order to use an interface in 2 TLB then you need to Use on in the other.

Dr. Delphi

Quote
Arthur Hoornweg wrote:
> Hi everyone, I have a problem of which I don't know where to start.
> I have developed a active-X DLL that implements a certain interface,
> let's call it iFileInfo. I registered the DLL and it works fine.

> Now I would like to create a new active-x DLL that re-implements
> the same interface for a different file type but with a perfectly identical
> iFiletype interface. iFileinfo will have many different implementations in
> the future, but the interface won't change.

> How do I do this, preferably using the TLB editor? Is it possible at all?
> How do I insert the "old" declaration into the new TLB?

> Another problem:  if I want to create a method in a certain
> interface that needs another interface as a parameter,
> the TLB editor only offers me iUnknown etc. as parameter types
> in the combobox. How can I enter my own "iFileinfo" as a
> parameter type, or must I do an explicit typecast to iUnknown?

> --
> Arthur Hoornweg
> (To answer me, please remove the ".net" from my e-mail address)

Re:Re-implementing existing interface using TLB editor?


Quote
> In order to use an interface in 2 TLB then you need to Use on in the
other.

> Dr. Delphi

Thank you! Unfortunately this enables me only to pass the interfaces,
not the dispinterfaces. I need a dispinterface as a parameter for a
method...

Arthur

Re:Re-implementing existing interface using TLB editor?


Since the typelib is a resource you can include it as a resource in your
new implementation.
You have to do something else too:
In the projectsource there's a COMMENT near the uses clause indicating the
coClass name.
You'll have to copy that to the new projectsource near the new
implementation unit.
Also, add {$R YourTypeLib.tlb} to the project source, note: NOT {$R *.tlb}

Off you go, its that easy!

Quote
Arthur Hoornweg wrote:
> > In order to use an interface in 2 TLB then you need to Use on in the
> other.

> > Dr. Delphi

> Thank you! Unfortunately this enables me only to pass the interfaces,
> not the dispinterfaces. I need a dispinterface as a parameter for a
> method...

> Arthur

  thaddy.dekoning.vcf
< 1K Download

Re:Re-implementing existing interface using TLB editor?


Since the typelib is a resource you can include it as a resource in your
new implementation.
You have to do something else too:
In the projectsource there's a COMMENT near the uses clause indicating
the
coClass name.
You'll have to copy that to the new projectsource near the new
implementation unit.
Also, add {$R YourTypeLib.tlb} to the project source, note: NOT {$R
*.tlb}

Off you go, its that easy!

Quote
Arthur Hoornweg wrote:
> > In order to use an interface in 2 TLB then you need to Use on in the
> other.

> > Dr. Delphi

> Thank you! Unfortunately this enables me only to pass the interfaces,
> not the dispinterfaces. I need a dispinterface as a parameter for a
> method...

> Arthur

  thaddy.dekoning.vcf
< 1K Download

Other Threads