Originale-mail to me for new edition

 

OleVariant

 

The OleVariant type exists on both the Windows and Linux platforms. The main difference between Variant and OleVariant is that Variant can contain data types that only the current application knows what to do with. OleVariant can only contain the data types defined as compatible with Ole Automation which means that the data types that can be passed between programs or across the network without worrying about whether the other end will know how to handle the data.

When you assign a Variant that contains custom data (such as a Pascal string, or a one of the new custom variant types) to an OleVariant, the runtime library tries to convert the Variant into one of the OleVariant standard data types (such as a Pascal string converts to an Ole BSTR string). For example, if a variant containing an AnsiString is assigned to an OleVariant, the AnsiString becomes a WideString. The same is true when passing a Variant to an OleVariant function parameter.

 

Topic groups

 

See also

Object interfaces: Overview

Variant types: Overview

 

 

译文

 

Ole变体

 

标准Ole变体类型OleVariant存在于WindowsLinux平台中。VariantOleVariant主要不同之处在于,Variant可以包含仅为当前应用程序所知道如何处理的数据类型,而OleVariant只能包含作为与Ole自动化兼容定义的数据类型,即数据类型可以在程序间或网络中传递,而不会担心最终的其他程序是否知道如何处理数据。

将一个包含了自定义数据(如一个Pascal串,或一个新的自定义的变体类型)的Variant赋值到一个OleVariant时,运行时库会试图将Variant转换为OleVariant标准数据类型之一(如一个Pascal串转换为一个Ole BSTR串)。例如,如果一个包含了AnsiString的变体被赋值到一个OleVariant,那么AnsiString将成为WideString。当把一个Variant作为参数传递给一个OleVariant函数时,处理的情形与此相同。

 

主题组

 

相关主题

对象接口:概述

变体类型:概述