The #import Statement in Visual C++
#import is new in Visual C++ v5.0. It is more like a supercharged macro than any real extension of the language. It simply reads the type library file you reference and generates header files with .TLI and .TLH extensions, placing them in the output directory of your project. VC really uses the .TLI and .TLH files to resolve early binding references. (It also uses them with RPC proxy functions, to make DCOM work.)
#import has a number of optional arguments. Two that I almost always use are:
#import "sometypelib.tlb" no_namespace named_guids
These ask #import not to wrap the classes created from the type library in a C++ namespace, and that the GUIDs be given programmer-friendly names, respectively. There are a number of other documented arguments as well.
There is one other interesting thing about #import and type libraries in general. In many, perhaps, most cases, a type library is not distributed as a standalone .TLB file at all. Rather, the type library is actually incorporated into the resources of the .EXE or .DLL file itself. So, don't be surprised if you see a line that looks like the following:
#import "myactivexserver.dll"
ActiveX controls always come with their type libraries included in the resources of the server's DLL. In this case, #import extracts the type library from the resources of the DLL or EXE and then creates the TLI and TLH files.