XUserWriteAchievements


XUserWriteAchievements


Writes one or more achievements to the specified profile.
DWORD XUserWriteAchievements(
  DWORD dwNumAchievements,
  CONST XUSER_ACHIEVEMENT *pAchievements,
  PXOVERLAPPED *pOverlapped
);

Parameters


dwNumAchievements
[in] Number of structures pointed to by
pAchievements.
pAchievements
[in] Pointer to an array of XUSER_ACHIEVEMENT structures containing information about the achievement/gamer profile pair being set.
pOverlapped
[in, out, optional] Pointer to an XOVERLAPPED structure used to monitor the status of the setting achievement operation. If
pOverlapped is zero, the operation is completed synchronously.

Return Values


Returns ERROR_SUCCESS if the function succeeds and returns immediately, ERROR_IO_PENDING to indicate that the asynchronous overlapped operation is pending, or an error code otherwise. The title can pause or render a wait animation until a subsequent check (using XGetOverlappedExtendedError) for ERROR_SUCCESS is found. If the achievement has already been awarded, this function will return 1.

Remarks


Titles are required to award Achievements only to the player who is the creator of the save game currently being played. Before awarding an Achievement, call XContentGetCreator to ensure that the player created the save game. There may be one or more TCRs that require or recommend the use of this function. See Technical Certification Requirements.
The buffer pointed to by pAchievements should stay valid during the entire asynchronous call. It should not be created on the stack.
Achievements can only be added to a shipped title as part of a content package and cannot be added in a title update. It is highly recommended that titles use a data-driven system to award achievements. For more information, see Achievements Overview.

Requirements


Header: Declared in Xbox.h.
Library: Use Xapilib.lib.

See Also


Achievements Sample, Achievements Overview | XContentGetCreator