VarEnum Enumeration
.NET Framework 2.0
Indicates how to marshal the array elements when an array is marshaled from managed to unmanaged code as a UnmanagedType.SafeArray.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Enumeration VarEnum 'Usage Dim instance As VarEnum
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ public enum VarEnum
SerializableAttribute ComVisibleAttribute(true) public enum VarEnum
| Member name | Description | |
|---|---|---|
![]() | VT_ARRAY | Indicates a SAFEARRAY pointer. |
![]() | VT_BLOB | Indicates length prefixed bytes. |
![]() | VT_BLOB_OBJECT | Indicates that a blob contains an object. |
![]() | VT_BOOL | Indicates a Boolean value. |
![]() | VT_BSTR | Indicates a BSTR string. |
![]() | VT_BYREF | Indicates that a value is a reference. |
![]() | VT_CARRAY | Indicates a C style array. |
![]() | VT_CF | Indicates the clipboard format. |
![]() | VT_CLSID | Indicates a class ID. |
![]() | VT_CY | Indicates a currency value. |
![]() | VT_DATE | Indicates a DATE value. |
![]() | VT_DECIMAL | Indicates a decimal value. |
![]() | VT_DISPATCH | Indicates an IDispatch pointer. |
![]() | VT_EMPTY | Indicates that a value was not specified. |
![]() | VT_ERROR | Indicates an SCODE. |
![]() | VT_FILETIME | Indicates a FILETIME value. |
![]() | VT_HRESULT | Indicates an HRESULT. |
![]() | VT_I1 | Indicates a char value. |
![]() | VT_I2 | Indicates a short integer. |
![]() | VT_I4 | Indicates a long integer. |
![]() | VT_I8 | Indicates a 64-bit integer. |
![]() | VT_INT | Indicates an integer value. |
![]() | VT_LPSTR | Indicates a null-terminated string. |
![]() | VT_LPWSTR | Indicates a wide string terminated by a null reference (Nothing in Visual Basic). |
![]() | VT_NULL | Indicates a null value, similar to a null value in SQL. |
![]() | VT_PTR | Indicates a pointer type. |
![]() | VT_R4 | Indicates a float value. |
![]() | VT_R8 | Indicates a double value. |
![]() | VT_RECORD | Indicates a user defined type. |
![]() | VT_SAFEARRAY | Indicates a SAFEARRAY. Not valid in a VARIANT. |
![]() | VT_STORAGE | Indicates that the name of a storage follows. |
![]() | VT_STORED_OBJECT | Indicates that a storage contains an object. |
![]() | VT_STREAM | Indicates that the name of a stream follows. |
![]() | VT_STREAMED_OBJECT | Indicates that a stream contains an object. |
![]() | VT_UI1 | Indicates a byte. |
![]() | VT_UI2 | Indicates an unsignedshort. |
![]() | VT_UI4 | Indicates an unsignedlong. |
![]() | VT_UI8 | Indicates an 64-bit unsigned integer. |
![]() | VT_UINT | Indicates an unsigned integer value. |
![]() | VT_UNKNOWN | Indicates an IUnknown pointer. |
![]() | VT_USERDEFINED | Indicates a user defined type. |
![]() | VT_VARIANT | Indicates a VARIANT far pointer. |
![]() | VT_VECTOR | Indicates a simple, counted array. |
![]() | VT_VOID | Indicates a C style void. |
Used with System.Runtime.InteropServices.MarshalAsAttribute to explicitly control the element type of the SafeArray.
Imports System Imports System.Runtime.InteropServices Module MyModule ' If you do not have a type library for an interface ' you can redeclare it using ComImportAttribute. ' This is how the interface would look in an idl file. '[ 'object, 'uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"), 'dual, helpstring("IMyStorage Interface"), 'pointer_default(unique) '] 'interface IMyStorage : IDispatch '{ ' [id(1)] ' HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem); ' [id(2)] ' HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems); ' [id(3)] ' HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems); ' [id(4), propget] ' HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty); '}; ' This is the managed declaration. <ComImport(), Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")> _ Public Interface IMyStorage <DispId(1)> _ Function GetItem(<InAttribute(), MarshalAs(UnmanagedType.BStr)> ByVal bstrName As String) _ As <MarshalAs(UnmanagedType.Interface)> Object <DispId(2)> _ Function GetItems(<InAttribute(), MarshalAs(UnmanagedType.BStr)> ByVal bstrLocation As String, _ <OutAttribute(), MarshalAs(UnmanagedType.SafeArray)> ByVal Items() As Object) <DispId(3)> _ Function GetItemDescriptions(<InAttribute()> ByVal bstrLocation As String, _ <InAttribute(), OutAttribute(), MarshalAs(UnmanagedType.SafeArray)> ByRef varDescriptions() As Object) <DispId(4)> _ ReadOnly Property IsEmpty(<MarshalAs(UnmanagedType.VariantBool)> ByVal bEmpty As Boolean) End Interface End Module
import System.*;
import System.Runtime.InteropServices.*;
// If you do not have a type library for an interface
// you can redeclare it using ComImportAttribute.
// This is how the interface would look in an idl file.
// [
// object,
// uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"),
// dual, helpstring("IMyStorage Interface"),
// pointer_default(unique)
// ]
// interface IMyStorage : IDispatch
// {
// [id(1)]
// HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem);
// [id(2)]
// HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems);
// [id(3)]
// HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems);
// [id(4), propget]
// HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty);
// };
// This is the managed declaration.
/** @attribute ComImport()
*/
/** @attribute Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")
*/
public interface IMyStorage
{
/** @attribute DispId(1)
*/
Object GetItem(
/** @attribute In()
@attribute MarshalAs(UnmanagedType.BStr)
*/String bstrName);
/** @attribute DispId(2)
*/
void GetItems(
/** @attribute In()
@attribute MarshalAs(UnmanagedType.BStr)
*/String bstrLocation,
/** @attribute Out()
@attribute MarshalAs(UnmanagedType.SafeArray,
SafeArraySubType = VarEnum.VT_VARIANT)
*/Object Items[]);
/** @attribute DispId(3)
*/
void GetItemDescriptions(
/** @attribute In()
*/String bstrLocation,
/** @attribute In()
@attribute Out()
@attribute MarshalAs(UnmanagedType.SafeArray)
*/Object varDescriptions[]);
/** @attribute DispId(4)
*/
/** @return MarshalAs(UnmanagedType.VariantBool)
*/
boolean get_IsEmpty();
} //IMyStorage
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show:
