IAudioSessionControl::GetLastInactivation method

The GetLastInactivation method retrieves the time at which the session last became inactive.


HRESULT GetLastInactivation(
  [out]  DATE *pRetVal


pRetVal [out]

Pointer to a caller-allocated DATE variable into which the method writes the date and time, in Universal Coordinated Time (UTC) format, of the last inactivation. For more information about DATE and UTC, see the Windows SDK documentation.

Return value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return codeDescription

Parameter pRetVal is NULL.


The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured, disabled, removed, or otherwise made unavailable for use.


The Windows audio service is not running.



An audio session is active if it contains one or more active audio streams. An active stream is in the running state. An inactive stream is in the stopped state. A session becomes active when its first stream becomes active. A session becomes inactive when its last active stream becomes inactive. The session state changes to expired when the client destroys the last stream in the session by releasing all references to the stream object.

The client assigns a stream to a session when it calls the IAudioClient::Initialize method to create the stream.

The client can determine the time at which the session last became active by calling the IAudioSessionControl::GetLastActivation method. The client can determine whether the session is currently active or inactive by calling the IAudioSessionControl::GetState method.


Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]



See also

IAudioSessionControl Interface



Send comments about this topic to Microsoft

Build date: 10/12/2013

Community Additions