SUMMARY
This step-by-step article describes how you can use the
#import directive to target a specific type library resource ID from a
single .dll file or from a single .exe file. By default, the type library is
extracted from the first resource of type
TypeLib. You can use the
tlbid(n) attribute with the
#import directive, where
n is the resource ID of the type library that you want to use.
back to the top
Using #import
If multiple type libraries are built into a single .dll file or a
single .exe file, you can use the
#import directive to target a specific type library resource. For
example, to target the type library
resource 2, use the following
tlbid switch:
#import "SERVER.DLL" tlbid(2)
This statement loads the type library
resource 2 from the file Server.dll, and then constructs header files that
incorporate information from that type library
resource 2.
By default, the type library is extracted from the
first resource of type
TypeLib, if the
tlbid directive is missing.
When you use this
tlbid switch, you get the same results that you get when you use the
LoadTypeLib("SERVER.DLL\\2") API call.
back to the top