Share via


SpCreateNewToken (By Category ID)

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This function creates a token coercively, based on category identifier. The token is created with the specified name, if provided. Otherwise, the function automatically generates a unique name.

Syntax

inline HRESULT SpCreateNewToken(
  const WCHAR* pszCategoryId,
  const WCHAR* pszTokenKeyName,
  ISpObjectToken** ppToken
);

Parameters

  • pszCategoryId
    [in] Pointer to a category identifier.
  • pszTokenKeyName
    [in, out] Pointer to the token key name. On input, an optional token key name is provided, or NULL. On output, this parameter points to the provided name with "Tokens" appended before it. If NULL is furnished as an input, the output is a unique token key name generated by the function.
  • ppToken
    [out] Address of a pointer to an object implementing ISpObjectToken. The token is created, if one does not currently exist.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

FAILED(hr)

Appropriate error message.

Example

The following code snippet illustrates the use of SpCreateNewToken (By Category ID) with the SPCAT_RECOPROFILES category identifier.

HRESULT hr = S_OK;
// create a new recognition profile
hr = SpCreateNewToken(SPCAT_RECOPROFILES, NULL, &cpObjectToken);
// Check hr

Requirements

Header sphelper.h
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

SAPI Functions