次の方法で共有


Data Type Conversion Functions

The following low-level functions convert variant data types. Higher-level variant manipulation functions (such as VariantChangeType) use these functions, but they can also be called directly.

Functions to convert to type char

From type Function
unsigned char VarI1FromUI1
unsigned short VarI1FromUI2
unsigned long VarI1FromUI4
ULONG64 VarI1FromUI8
short VarI1FromI2
long VarI1FromI4
LONG64 VarI1FromI8
float VarI1FromR4
double VarI1FromR8
CURRENCY VarI1FromCy
DECIMAL VarI1FromDec
DATE VarI1FromDate
OLECHAR * VarI1FromStr
IDispatch * VarI1FromDisp
BOOL VarI1FromBool

 

Functions to convert to type unsigned char

From type Function
unsigned short VarUI1FromUI2
unsigned long VarUI1FromUI4
ULONG64 VarI1FromUI8
char VarUI1FromI1
short VarUI1FromI2
long VarUI1FromI4
LONG64 VarUI1FromI8
float VarUI1FromR4
double VarUI1FromR8
CURRENCY VarUI1FromCy
DECIMAL VarUI1FromDec
DATE VarUI1FromDate
OLECHAR * VarUI1FromStr
IDispatch * VarUI1FromDisp
BOOL VarUI1FromBool

 

Functions to convert to type short

From type Function
unsigned char VarI2FromUI1
unsigned short VarI2FromUI2
unsigned long VarI2FromUI4
ULONG64 VarI2FromUI8
char VarI2FromI1
long VarI2FromI4
LONG64 VarI2FromI8
float VarI2FromR4
double VarI2FromR8
CURRENCY VarI2FromCy
DECIMAL VarI2FromDec
DATE VarI2FromDate
OLECHAR * VarI2FromStr
IDispatch * VarI2FromDisp
BOOL VarI2FromBool

 

Functions to convert to type unsigned short

From type Function
char VarUI2FromI1
short VarUI2FromI2
long VarUI2FromI4
LONG64 VarUI2FromI8
unsigned char VarUI2FromUI1
unsigned long VarUI2FromUI4
LONG64 VarUI2FromUI8
float VarUI2FromR4
double VarUI2FromR8
CURRENCY VarUI2FromCy
DECIMAL VarUI2FromDec
DATE VarUI2FromDate
OLECHAR * VarUI2FromStr
IDispatch * VarUI2FromDisp
BOOL VarUI2FromBool

 

Functions to convert to type long

From type Function
unsigned short VarI4FromUI2
unsigned long VarI4FromUI4
ULONG64 VarI4FromUI8
char VarI4FromI1
unsigned char VarI4FromUI1
short VarI4FromI2
LONG64 VarI4FromI8
float VarI4FromR4
double VarI4FromR8
CURRENCY VarI4FromCy
DECIMAL VarI4FromDec
DATE VarI4FromDate
OLECHAR * VarI4FromStr
IDispatch * VarI4FromDisp
BOOL VarI4FromBool
INT VarI4FromInt

 

Functions to convert to type unsigned long

From type Function
unsigned short VarUI4FromUI2
char VarUI4FromI1
short VarUI4FromI2
unsigned char VarUI4FromUI1
ULONG64 VarUI4FromUI8
long VarUI4FromI4
LONG64 VarUI4FromI8
float VarUI4FromR4
double VarUI4FromR8
CURRENCY VarUI4FromCy
DECIMAL VarUI4FromDec
DATE VarUI4FromDate
OLECHAR * VarUI4FromStr
IDispatch * VarUI4FromDisp
BOOL VarUI4FromBool

 

Functions to convert to type float

From type Function
unsigned short VarR4FromUI2
unsigned long VarR4FromUI4
ULONG64 VarR4FromUI8
char VarR4FromI1
unsigned char VarR4FromUI1
short VarR4FromI2
long VarR4FromI4
LONG64 VarR4FromI8
double VarR4FromR8
CURRENCY VarR4FromCy
DECIMAL VarR4FromDec
DATE VarR4FromDate
OLECHAR * VarR4FromStr
IDispatch * VarR4FromDisp
BOOL VarR4FromBool

 

Functions to convert to type double

From type Function
unsigned short VarR8FromUI2
unsigned long VarR8FromUI4
ULONG64 VarR8FromUI8
char VarR8FromI1
unsigned char VarR8FromUI1
short VarR8FromI2
long VarR8FromI4
LONG64 VarR8FromI8
float VarR8FromR4
CURRENCY VarR8FromCy
DECIMAL VarR8FromDec
DATE VarR8FromDate
OLECHAR * VarR8FromStr
IDispatch * VarR8FromDisp
BOOL VarR8FromBool

 

Functions to convert to type DATE

From type Function
unsigned short VarDateFromUI2
unsigned long VarDateFromUI4
ULONG64 VarDateFromUI8
char VarDateFromI1
unsigned char VarDateFromUI1
short VarDateFromI2
long VarDateFromI4
LONG64 VarDateFromI8
float VarDateFromR4
double VarDateFromR8
CURRENCY VarDateFromCy
DECIMAL VarDateFromDec
OLECHAR * VarDateFromStr
IDispatch * VarDateFromDisp
BOOL VarDateFromBool

 

Functions to convert to type CURRENCY

From type Function
unsigned short VarCyFromUI2
unsigned long VarCyFromUI4
ULONG64 VarCyFromUI8
char VarCyFromI1
unsigned char VarCyFromUI1
short VarCyFromI2
long VarCyFromI4
LONG64 VarCyFromI8
float VarCyFromR4
double VarCyFromR8
DECIMAL VarCyFromDec
DATE VarCyFromDate
OLECHAR * VarCyFromStr
IDispatch * VarCyFromDisp
BOOL VarCyFromBool

 

Functions to convert to type BSTR

From type Function
unsigned short VarBstrFromUI2
unsigned long VarBstrFromUI4
ULONG64 VarBstrFromUI8
char VarBstrFromI1
unsigned char VarBstrFromUI1
short VarBstrFromI2
long VarBstrFromI4
LONG64 VarBstrFromI8
float VarBstrFromR4
double VarBstrFromR8
CURRENCY VarBstrFromCy
DECIMAL VarBstrFromDec
DATE VarBstrFromDate
IDispatch * VarBstrFromDisp
BOOL VarBstrFromBool

 

Functions to convert to type BOOL

From type Function
unsigned short VarBoolFromUI2
unsigned long VarBoolFromUI4
ULONG64 VarBoolFromUI8
char VarBoolFromI1
unsigned char VarBoolFromUI1
short VarBoolFromI2
long VarBoolFromI4
LONG64 VarBoolFromI8
float VarBoolFromR4
double VarBoolFromR8
CURRENCY VarBoolFromCy
DECIMAL VarBoolFromDec
DATE VarBoolFromDate
OLECHAR * VarBoolFromStr
IDispatch * VarBoolFromDisp

 

Functions to convert to type DECIMAL

From type Function
unsigned short VarDecFromUI2
unsigned long VarDecFromUI4
ULONG64 VarDecFromUI8
char VarDecFromI1
usigned char VarDecFromUI1
short VarDecFromI2
long VarDecFromI4
LONG64 VarDecFromI8
float VarDecFromR4
double VarDecFromR8
CURRENCY VarDecFromCy
DATE VarDecFromDate
OLECHAR * VarDecFromStr
IDispatch * VarDecFromDisp
BOOL VarDecFromBool

 

Note

If these functions are passed NULL pointers, there will be an access violation and the program will crash. It is your responsibility to protect these functions against NULL pointers.

 

Conversion and Manipulation Functions