VarEnum 列挙型

定義

注意事項

Marshalling VARIANTs may be unavailable in future releases.

配列が SafeArray としてマネージド コードからアンマネージド コードにマーシャリングされる場合の、配列要素のマーシャリング方法を示します。

public enum class VarEnum
[System.Obsolete("Marshalling VARIANTs may be unavailable in future releases.")]
public enum VarEnum
public enum VarEnum
[System.Serializable]
public enum VarEnum
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum VarEnum
[<System.Obsolete("Marshalling VARIANTs may be unavailable in future releases.")>]
type VarEnum = 
type VarEnum = 
[<System.Serializable>]
type VarEnum = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type VarEnum = 
Public Enum VarEnum
継承
属性

フィールド

VT_ARRAY 8192

SAFEARRAY ポインターを示します。

VT_BLOB 65

長さのプリフィックスが付いたバイトを示します。

VT_BLOB_OBJECT 70

BLOB がオブジェクトを格納していることを示します。

VT_BOOL 11

ブール値を示します。

VT_BSTR 8

BSTR 文字列を示します。

VT_BYREF 16384

値が参照であることを示します。

VT_CARRAY 28

C スタイル配列を示します。

VT_CF 71

クリップボード形式を示します。

VT_CLSID 72

クラス ID を示します。

VT_CY 6

通貨値を示します。

VT_DATE 7

DATE 値を示します。

VT_DECIMAL 14

decimal 値を示します。

VT_DISPATCH 9

IDispatch ポインターを示します。

VT_EMPTY 0

値が指定されなかったことを示します。

VT_ERROR 10

SCODE を示します。

VT_FILETIME 64

FILETIME 値を示します。

VT_HRESULT 25

HRESULT を示します。

VT_I1 16

char 値を示します。

VT_I2 2

short 整数を示します。

VT_I4 3

long 整数を示します。

VT_I8 20

64 ビット整数を示します。

VT_INT 22

整数値を示します。

VT_LPSTR 30

null で終わる文字列を示します。

VT_LPWSTR 31

null で終わるワイド文字列を示します。

VT_NULL 1

Null 値を示します。これは、SQL における Null 値に相当します。

VT_PTR 26

ポインター型を示します。

VT_R4 4

float 値を示します。

VT_R8 5

double 値を示します。

VT_RECORD 36

ユーザー定義型を示します。

VT_SAFEARRAY 27

SAFEARRAY を示します。 VARIANT では有効ではありません。

VT_STORAGE 67

ストレージの名前が続くことを示します。

VT_STORED_OBJECT 69

ストレージがオブジェクトを格納していることを示します。

VT_STREAM 66

ストリームの名前が続くことを示します。

VT_STREAMED_OBJECT 68

ストリームがオブジェクトを格納していることを示します。

VT_UI1 17

byte を示します。

VT_UI2 18

unsignedshort を示します。

VT_UI4 19

unsignedlong を示します。

VT_UI8 21

64 ビット符号なし整数を示します。

VT_UINT 23

unsigned 整数値を示します。

VT_UNKNOWN 13

IUnknown ポインターを示します。

VT_USERDEFINED 29

ユーザー定義型を示します。

VT_VARIANT 12

VARIANT far ポインターを示します。

VT_VECTOR 4096

カウントされた単純な配列を示します。

VT_VOID 24

C スタイル void を示します。

using namespace System;
using namespace 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.

[ComImport]
[Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")]
interface class IMyStorage
{
   [DispId(1)]
   Object^ GetItem( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrName );

   //[return : MarshalAs(UnmanagedType::Interface)]

   [DispId(2)]
   void GetItems( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrLocation, [Out,MarshalAs(UnmanagedType::SafeArray,
   SafeArraySubType=VarEnum::VT_VARIANT)]array<Object^>^Items );

   [DispId(3)]
   void GetItemDescriptions( [In]String^ bstrLocation, [In,Out,MarshalAs(UnmanagedType::SafeArray)]array<Object^>^varDescriptions );

   property bool IsEmpty 
   {
      [DispId(4)]
      [returnvalue:MarshalAs(UnmanagedType::VariantBool)]
      bool get();
   }
};
using System;
using System.Runtime.InteropServices;

namespace 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)]
        [return : MarshalAs( UnmanagedType.Interface )]
        Object GetItem( [In, MarshalAs( UnmanagedType.BStr )] String bstrName );

        [DispId(2)]
        void GetItems( [In, MarshalAs( UnmanagedType.BStr )] String bstrLocation,
            [Out, MarshalAs( UnmanagedType.SafeArray,
                      SafeArraySubType = VarEnum.VT_VARIANT )] out Object[] Items );

        [DispId(3)]
        void GetItemDescriptions( [In] String bstrLocation,
            [In, Out, MarshalAs( UnmanagedType.SafeArray )] ref Object[] varDescriptions );

        bool IsEmpty
        {
            [DispId(4)]
            [return : MarshalAs( UnmanagedType.VariantBool )]
            get;
        }
    }
}
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, SafeArraySubType := VarEnum.VT_VARIANT)> _
                                      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

注釈

の要素型を明示的に制御するために使用 System.Runtime.InteropServices.MarshalAsAttribute されます SafeArray

適用対象

こちらもご覧ください