views:

47

answers:

1

I created ATL COM-server in VC++ 2005. I want to realize some interface defined in some library (*.olb). I know I will see the interface if I #import this olb (in .tlh.tli). But I cannot create stub realization for the interface with "Implement interface wizard" because this interface is absent in "Interfaces" list (both for "Registry" and "File" options). Why is it possible such situation? And how do I automathically generate stub realization. Thanks in advance.

+1  A: 

You could edit the .idl file and use

[
    ...
]
library Something
{
    importlib("somelibrary.olb"); 
    ... 
}

That's awkward however, the importlib statement must appear inside the library block. This is necessary because the type library probably contains coclass definitions.

What you really want is to use the import statement to import the IDL that created the type library. Minus the coclasses. If you don't have the IDL, you can re-create it with OleView.exe, File + View Typelib. Copy and paste the interface definitions you want in your own .idl file, then use the import MIDL statement in your IDL.

Hans Passant
I found a bug in the project. It was a mess with libraries.Anyway, thank you for oleview way. I really like it.
Oleg Svechkarenko