AvSetMmThreadCharacteristicsA function

Associates the calling thread with the specified task.


AVRTAPI HANDLE AvSetMmThreadCharacteristicsA(
  LPCSTR  TaskName,
  LPDWORD TaskIndex



The name of the task to be performed. This name must match the name of one of the subkeys of the following key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks.


The unique task identifier. The first time this function is called, this value must be 0 on input. The index value is returned on output and can be used as input in subsequent calls.

Return Value

If the function succeeds, it returns a handle to the task.

If the function fails, it returns 0. To retrieve extended error information, call GetLastError.

The following are possible error codes.

Return code Description
Either TaskIndex is not 0 on the first call or is not recognized value (on subsequent calls).
The specified task does not match any of the tasks stored in the registry.
The caller does not have sufficient privilege.


When the task is completed, call the AvRevertMmThreadCharacteristics function.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header avrt.h
Library Avrt.lib
DLL Avrt.dll

See Also

Multimedia Class Scheduler Service