VarTokenizeFormatString function (oleauto.h)

Parses the actual format string into a series of tokens which can be used to format variants using VarFormatFromTokens.

Syntax

HRESULT VarTokenizeFormatString(
  [in, optional] LPOLESTR pstrFormat,
  [in, out]      LPBYTE   rgbTok,
  [in]           int      cbTok,
  [in]           int      iFirstDay,
  [in]           int      iFirstWeek,
  [in]           LCID     lcid,
  [in, optional] int      *pcbActual
);

Parameters

[in, optional] pstrFormat

The format string. For example "mm-dd-yy".

[in, out] rgbTok

The destination token buffer.

[in] cbTok

The size of the destination token buffer.

[in] iFirstDay

First day of the week.

Value Meaning
0
The system default
1
Monday
2
Tuesday
3
Wednesday
4
Thursday
5
Friday
6
Saturday
7
Sunday

[in] iFirstWeek

First week of the year.

Value Meaning
0
The system default.
1
The first week contains January 1st.
2
The larger half (four days) of the first week is in the current year.
3
The first week has seven days.

[in] lcid

The locale to interpret format string in.

[in, optional] pcbActual

Points to the integer which is set to the first generated token. This parameter can be NULL.

Return value

This function can return one of these values.

Return code Description
S_OK
Success.
E_INVALIDARG
One or more of the arguments is not valid.
DISP_E_BUFFERTOOSMALL
The destination token buffer is too small.

Remarks

Parsing the format string once and then using it repeatedly is usually faster than calling VarFormat repeatedly, because the latter routine calls VarTokenizeFormatString for each call.

The locale you pass in controls how the format string is interpreted, not how the actual output of VarFormatFromTokens looks.

Requirements

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