Reputation: 30504
I have two type libraries with COM interfaces that I wrote using ATL and Microsoft's IDL. I would like an interface in one library to inherit from an interface in the other.
Essentially, I would like to do the same thing that Steven described at How do I create interface methods using .tlb types in VS C++?. The only person who answered him did not seem to understand the question.
Here's what I'd like to do, in code:
interface ISomeInterface : IDispatch { ... };
import "ISomeInterface.idl";
library SomeLibrary
{
interface ISomeInterface;
};
// What do I put here so that the MIDL compiler knows
// what to do when it encounters the ISomeInterface type?
interface ISomeOtherInterface : ISomeInterface { ... };
import "ISomeOtherInterface.idl";
library SomeOtherLibrary
{
interface ISomeOtherInterface;
};
The MIDL import
directive only works when importing IDL files, and I only have a DLL and TLB. I can't use importlib
because that only works within a library
definition. The MIDL compiler doesn't understand Microsoft's C++ import
, importidl
, and importlib
attributes.
What to do?
Upvotes: 5
Views: 3295
Reputation: 40336
If you are willing to introduce a manual step, you can open the tlb in oleview and get a generated .idl file that way. oleview.exe lives in the bin dir of the Windows SDK, eg
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\oleview.exe
Upvotes: 2