Share via


VarNumFromParseNum

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

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

Parameters

  • pnumprs
    [in] Parsed results. cDig = size of rgbDig

  • rgbDig
    [in] Contains the values of the digits. The cDig member of NUMPARSE contains the number of digits.

  • dwVtBits
    [in] 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:

    Flag Description
    VTBIT_I1 Type can be CHAR
    VTBIT_UI1 Type can be unsigned char
    VTBIT_I2 Type can be short
    VTBIT_UI2 Type can be USHORT
    VTBIT_I4 Type can be long
    VTBIT_UI4 Type can be ULONG
    VTBIT_R4 Type can be float
    VTBIT_R8 Type can be double
    VTBIT_CY Type can be CURRENCY
    VTBIT_DECIMAL Type can be DECIMAL
  • pvar
    [out] Pointer to the result variant.

Return Values

The following table shows the HRESULT values that can be returned by this function.

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 invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oleauto.h.
Link Library: Oleaut32.lib.

See Also

VARIANT

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.