[
object,
uuid(03527441-7BA5-11D0-8CAA-FD10872CC837),
dual,
helpstring("IQuadrangle Interface"),
pointer_default(unique)
]
interface IQuadrangle : IDispatch {
};
[
uuid(0187E5D7-79B1-11D0-8CAA-FD10872CC837),
helpstring("Quadrangle Class")
]
coclass Quadrangle
{
[default] interface IQuadrangle;
};
Figure 6 Properties Added to IQuadrangle
interface IQuadrangle : IDispatch
{
[propget, id(1), helpstring("property Height")]
HRESULT Height([out, retval] double *pVal);
[propput, id(1), helpstring("property Height")]
HRESULT Height([in] double newVal);
[propget, id(2), helpstring("property Width")]
HRESULT Width([out, retval] double *pVal);
[propput, id(2), helpstring("property Width")]
HRESULT Width([in] double newVal);
[propget, id(3), helpstring("property Depth")]
HRESULT Depth([out, retval] double *pVal);
[propput, id(3), helpstring("property Depth")]
HRESULT Depth([in] double newVal);
};
Figure 7 Summary of #import Directive Attributes
|
These attributes may be applied to the #import directive to tailor the TLH and TLI files generated by the #import directive. |
| exclude |
exclude("Name1"[, "Name2",...])
ArgumentsName1: First item to be excluded Name2: Second item to be excluded (if necessary) Summary Excludes specific items from the type library header files generated by the #import directive. |
| high_method_prefix |
high_method_prefix("Prefix")
ArgumentsPrefix: Prefix to be used Summary By default, member functions expose high-level error-handling properties and methods that are named without a prefix. The high_method_prefix attribute specifies a prefix for naming these high-level properties and methods. |
| high_property_prefixes |
high_property_prefixes("GetPrefix","PutPrefix","PutRefPrefix")
ArgumentsGetPrefix: Prefix to be used for the propget methods PutPrefix: Prefix to be used for the propput methods PutRefPrefix: Prefix to be used for the propputref methods Summary By default, propget, propput, and propputref member functions expose high-level error-handling methods named using prefixes Get, Put, and PutRef, respectively. The high_property_prefixes attribute specifies alternate prefixes for all three property methods. |
| implementation_only |
|
Summary The implementation_only attribute suppresses the generation of the TLH header file (the primary header file). When this attribute is specified, the content of the TLI header is in the same namespace as the one normally used in the TLH header. In addition, the member functions are not declared as inline. The implementation_only attribute is intended for use in conjunction with the no_implementation attribute as a way of keeping the implementations out of the precompiled header (PCH) file. |
| inject_statement |
inject_statement("source_text")
Argumentssource_text: Source text to be inserted into the type-library header file Summary Inserts its argument as source text into the type library header, placing the text at the beginning of the namespace declaration that wraps the type-library contents in the header file. |
| named_guids |
|
Summary The named_guids attribute tells the compiler to define and initialize GUID variables in old style. That is, using the form LIBID_MyLib, CLSID_MyCoClass, IID_MyInterface, and DIID_MyDispInterface. |
| no_implementation |
|
Summary Suppresses generation of the TLI header (containing the implementations of the wrapper member functions). If this attribute is specified, the TLH header won't #include the TLI header file. |
| no_namespace |
|
Summary Contents of a type-library header file are normally defined in a namespace. That namespace defaults to the name used in the library statement of the original IDL file. The no_namespace attribute suppresses the namespace in the type library header file. |
| raw_dispinterfaces |
|
Summary Tells the compiler to generate low-level wrapper functions for dispinterface methods and properties that call IDispatch::Invoke and return the HRESULT error code. By default, the #import directive generates high-level wrappers, which throw C++ exceptions in case of failure. |
| raw_interfaces_only |
|
Summary Suppresses the generation of error-handling wrapper functions and __declspec(property) declarations that use those wrapper functions. |
| raw_method_prefix |
raw_method_prefix("Prefix")
ArgumentsPrefix: The prefix to be used Summary Member functions expose low-level properties and methods named with a default prefix of raw_ to avoid name collisions with the high-level error-handling member functions. The raw_method_prefix attribute specifies a different prefix. |
| raw_native_types |
|
Summary By default, the high-level error-handling methods use the COM support classes _bstr_t and _variant_t in place of the BSTR and VARIANT data types, and raw COM interface pointers to encapsulate the details of handling BSTRs and VARIANTs. The raw_native_types attribute disables the use of these COM support classes in the high-level wrapper functions, and forces the type library header to use low-level data types instead. |
| raw_property_prefixes |
raw_property_prefixes("GetPrefix","PutPrefix","PutRefPrefix")
ArgumentsGetPrefix: Prefix to be used for the propget methods PutPrefix: Prefix to be used for the propput methods PutRefPrefix: Prefix to be used for the propputref methods Summary By default, low-level propget, propput, and propputref methods are exposed by member functions named with prefixes of get_, put_, and putref_, respectively. These prefixes are compatible with the names used in the header files generated by MIDL. The raw_property_prefixes attribute is used to specify alternate prefixes for all three property methods. |
| rename |
rename("OldName","NewName")
ArgumentsOldName: Old name in the type library NewName: Name to be used instead of the old name Summary Functions as a search and replace to work around name collision problems. Applying this attribute causes the compiler to replace all occurrences of OldName in a type library with the user-supplied NewName in the resulting header files. |
| rename_namespace |
rename_namespace("NewName")
ArgumentsNewName: The new name of the namespace Summary The rename_namespace attribute is used to rename the namespace that contains the contents of the type library. The single argument NewName specifies the new name for the namespace. |