Background:
- The .TLB file contains interfaces written in language 'X'. I don't have .h, .idl, .tlh, or any other header files - just the .TLB file. Language 'X' does not export compatible .h, .idl, etc.
- I use the VS wizard to add an ATL simple object to my ATL project.
I want to add a method to the interface of my simple ATL object that uses one of the .TLB defined types for a parameter.
// Something like the following in the .idl file:
interface ISomeInterface : IUnknown {
HRESULT SomeMethod([in] ITypeFromTLB* aVal); // ITypeFromTLB declared in .TLB file.
};
How can I do this? I'm hoping for a wizard, or a line in the .idl interface declaration that would bring in the .tlb information. midl's include (no .tlb), import (no tlb), and importlib (library only) don't seem to provide a solution (I need proxy/stub to be working, so I cannot put this inside the library declaration with the importlib command).
Use #import in cpp/h to bring TLB interfaces to your namespace.
On Visual Studio command line do oleview. Then File -> View Type Lib, give it full path to your foo.tlb. Now in ITypeLib Viewer do File -> Save As .. and you can export all 3 (.h, .idl, .c) from there.