VarNumFromParseNum

This function converts the parsed number to a number of the VARIANT type.

At a Glance

Header file: Oleauto.h
Windows CE versions: 2.0 and later

Syntax

HRESULT VarNumFromParseNum( [in] NUMPARSE * pnumprs, [in] unsigned char * rgbDig, [in] unsigned long dwVtBits, [out] VARIANT * pvar);

Parameters

pnumprs

Parsed results. cDig = size of rgbDic

rgbDig

Contains the values of the digits. The cDig member of NUMPARSE contains the number of digits.

dwVtBits

Contains one bit set for each type that is acceptable as a return value (in many cases, just one bit).

The following VarNumFromParseNum flags indicate acceptable result types:

VTBIT_I1 VTBIT_UI4
VTBIT_UI1 VTBIT_R4
VTBIT_I2 VTBIT_R8
VTBIT_UI2 VTBIT_CY
VTBIT_I4 VTBIT_DECIMAL

pvar

Pointer to the result variant.

Return Value

One of the values obtained from the returned HRESULT and described in the following table is returned.

Value Description
S_OK Success.
E_OUTOFMEMORY Out of memory.
DISP_E_OVERFLOW The number is too large to be represented in an allowed type. There is no error if precision is lost in the conversion.

For rounding decimal numbers, the digit array must be at least one digit longer than the maximum required for data types. The maximum number of digits required for the DECIMAL data type is 29, so the digit array must have room for 30 digits. There must also be enough digits to accept the number in octal, if that parsing options is selected. (Hexadecimal and octal numbers are limited by VarNumFromParseNum to the magnitude of an unsigned long [32 bits], so they need 11 octal digits.)

Remarks

Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.