大网数据广告活动
Windows 系统接口

Data Type Conversions

· 52CE 我爱测

Each programming language defines certain types and containers for data. Most of these data types, especially the primitives, map easily to other programming languages. Some data types, however, have no equivalent in another language and cannot be converted.

Each programming language defines certain types and containers for data. Most of these data types, especially the primitives, map easily to other programming languages. Some data types, however, have no equivalent in another language and cannot be converted.

For specific information about data types not recognized by your programming language, see the following topics:

The following table lists conversions between programming languages for common data types.

C++ Visual Basic Java Contains
signed char Not supported byte 1-byte signed integer (VT_I1, [T])
unsigned char Byte Not supported 1-byte unsigned integer (VT_UI1, [V][T][P][S])
unsigned char Character char 2-byte Unicode character (VT_UI2, [T][P])
short Integer short 2-byte signed integer (VT_I2, [V][T][P][S])
unsigned short Not supported Not supported 2-byte unsigned integer (VT_UI2, [T][P])
int Long int 4-byte signed integer (VT_I4, [V][T][P][S])
unsigned int Not supported Not supported 4-byte unsigned integer (VT_UI4, [T][P])
__int64 Not supported long 8-byte signed integer (VT_I8, [T][P])
unsigned __int64 Not supported Not supported 8-byte unsigned integer (VT_UI8, [T][P])
float Single float 4-byte floating-point number (VT_R4, [V][T][P][S])
double Double double 8-byte floating-point number (VT_R8, [V][T][P][S])
BSTR String java.lang.String Automation string (VT_BSTR, [V][T][P][S])
BOOL Boolean boolean Boolean (VT_BOOL, [V][T][P][S])
VARIANT Variant com.ms.com.Variant VARIANT FAR* (VT_VARIANT, [V][T][P][S])
IUnknown object com.ms.com.IUnknown IDispatch interface pointer (VT_DISPATCH, [V][T][P][S])
DATE Date com.ms.com.Variant Date (VT_DATE, [V][T][P][S])
CURRENCY Currency com.ms.com.Variant Currency (VT_CY, [V][T][P][S] or VT_DECIMAL, [V][T][S])

For information about VARTYPE values and how to use them, see the topic IDispatch Data Types and Structures.

The data type conversions between scripting languages are simpler than those for programming languages. JScript and JavaScript both support the same data types, and VBScript supports only a single data type, Variant. Thus, all JScript and JavaScript data types become Variant types when converted to VBScript. When you convert VBScript to JScript or JavaScript, the Variant types become numbers, strings, Boolean values, and so on.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。