VarTokenizeFormatString Function

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

LPBYTE VarTokenizeFormatString(
  LPOLESTR  pstrFormat,
  LPBYTE  rgbTok,
  int   cbTok,
  int   iFirstDay,
  int   iFirstWeek,
  LCID  lcid,
  int *pcbActual
);

pstrFormat

[in] Points to the format string for example "mm-dd-yy".

rgbTok

[in, out] Points to the destination token buffer.

cbTok

[in] Size of the destination token buffer.

iFirstDay

[in] First day of the week, 0 = system default, 1 = Monday, 2 = Tuesday etc.

iFirstWeek

[in] First week of the year. The following table describes the values for iFirstWeek:

iFirstWeek Values

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.

lcid

[in] Locale to interpret format string in.

pcbActual

[out] Points to the integer which is set to the first generated token. Can be NULL.

The function returns one of the following:

Return value

Meaning

S_OK

Success.

E_INVALIDARG

One or more of the arguments is invalid.

DISP_E_BUFFERTOOSMALL

The destination token buffer is too small.

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

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

Show:
© 2014 Microsoft