VarFormatPercent function (oleauto.h)

Formats a variant containing percentages into a string form.


HRESULT VarFormatPercent(
  [in]  LPVARIANT pvarIn,
  [in]  int       iNumDig,
  [in]  int       iIncLead,
  [in]  int       iUseParens,
  [in]  int       iGroup,
  [in]  ULONG     dwFlags,
  [out] BSTR      *pbstrOut


[in] pvarIn

The variant containing the value to format.

[in] iNumDig

The number of digits to pad to after the decimal point. Specify -1 to use the system default value.

[in] iIncLead

Specifies whether to include the leading digit on numbers.

Value Meaning
Use the system default.
Include the leading digit.
Do not include the leading digit.

[in] iUseParens

Specifies whether negative numbers should use parentheses.

Value Meaning
Use the system default.
Use parentheses.
Do not use parentheses.

[in] iGroup

Specifies whether thousands should be grouped. For example 10,000 versus 10000.

Note  Regular numbers and currencies have separate system defaults for all the above options.
Value Meaning
Use the system default.
Group thousands.
Do not group thousands.

[in] dwFlags

VAR_CALENDAR_HIJRI is the only flag that can be set.

[out] pbstrOut

Receives the formatted string that represents the variant.

Return value

This function can return one of these values.

Return code Description
One or more of the arguments is not valid.


This function uses the user's default locale while calling VarTokenizeFormatString and VarFormatFromTokens.


Target Platform Windows
Header oleauto.h
Library OleAut32.lib
DLL OleAut32.dll