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

날짜 값을 나타냅니다.

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

SQL의 null 값과 유사한 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.

적용 대상

추가 정보