The #import Directive C++ Specific The #import directive is used to incorporate information from a type library. The content of the type library is converted into C++ classes, mostly describing the COM interfaces.Syntax#import "filename" [attributes]#import <filename> [attributes]attributes:attribute1, attribute2, ...attribute1 attribute2 ...filename is the name of the file containing the type library information. A file can be one of the following types: a type library (.TLB or .ODL) file an executable (.EXE) file a library (.DLL) file containing a type library resource (such as .OCX) a compound document holding a type library any other file format that can be understood by the LoadTypeLib API The filename is optionally preceded by a directory specification. The filename must name an existing file. The difference between the two forms is the order in which the preprocessor searches for the type library files when the path is incompletely specified.Syntax Form Action Quoted form This form instructs the preprocessor to first look for type library files in the same directory of the file that contains the #import statement, and then in the directories of whatever files that include (#include) that file. The preprocessor then searches along the paths shown below. Angle-bracket form This form instructs the preprocessor to search for type library files along the paths shown below. The compiler will search in the following directories for the named file: the PATH environment variable path list the LIB environment variable path list the path specified by the /I (additional include directories) compiler option #import can optionally include one or more attributes. These attributes tell the compiler to modify the contents of the type-library headers. A backslash (\) symbol can be used to include additional lines in a single #import statement. For example:#import “test.lib” no_namespace \ rename(“OldName”, “NewName”)The #import attributes are listed below:exclude high_method_prefix high_property_prefixes implementation_only include(…) inject_statement named_guids no_auto_exclude no_implementation no_namespace raw_dispinterfaces raw_interfaces_only raw_method_prefix raw_native_types raw_property_prefixes rename rename_namespace
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename ("EOF", "adoEOF")
C++ Specific The #import directive is used to incorporate information from a type library. The content of the type library is converted into C++ classes, mostly describing the COM interfaces.Syntax#import "filename" [attributes]#import <filename> [attributes]attributes:attribute1, attribute2, ...attribute1 attribute2 ...filename is the name of the file containing the type library information. A file can be one of the following types: a type library (.TLB or .ODL) file
an executable (.EXE) file
a library (.DLL) file containing a type library resource (such as .OCX)
a compound document holding a type library
any other file format that can be understood by the LoadTypeLib API
The filename is optionally preceded by a directory specification. The filename must name an existing file. The difference between the two forms is the order in which the preprocessor searches for the type library files when the path is incompletely specified.Syntax Form Action
Quoted form This form instructs the preprocessor to first look for type library files in the same directory of the file that contains the #import statement, and then in the directories of whatever files that include (#include) that file. The preprocessor then searches along the paths shown below.
Angle-bracket form This form instructs the preprocessor to search for type library files along the paths shown below.
The compiler will search in the following directories for the named file: the PATH environment variable path list
the LIB environment variable path list
the path specified by the /I (additional include directories) compiler option
#import can optionally include one or more attributes. These attributes tell the compiler to modify the contents of the type-library headers. A backslash (\) symbol can be used to include additional lines in a single #import statement. For example:#import “test.lib” no_namespace \
rename(“OldName”, “NewName”)The #import attributes are listed below:exclude high_method_prefix
high_property_prefixes implementation_only
include(…) inject_statement
named_guids no_auto_exclude
no_implementation no_namespace
raw_dispinterfaces raw_interfaces_only
raw_method_prefix raw_native_types
raw_property_prefixes rename
rename_namespace
http://www.csdn.net/expert/topic/914/914837.xml?temp=.2331964
http://www.csdn.net/expert/topic/564/564540.xml?temp=.7023279