IUserNotification2::PlaySound Method

Plays a sound in conjunction with the notification.

Syntax

HRESULT PlaySound(      
    LPCWSTR pszSoundName
);

Parameters

  • pszSoundName
    [in] A pointer to a null-terminated Unicodestring that specifies the alias of the sound file to play.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The string pointed to by pszSoundName contains an alias for a system event found in the registry or the Win.ini file; for instance, "SystemExit".

The specified sound is played asynchronously and the method returns immediately after beginning the sound. To stop an asynchronous waveform sound, call IUserNotification2::PlaySound with pszSoundName set to NULL.

The specified sound event will yield to another sound event that is already playing. If a sound cannot be played because the resource needed to play that sound is busy, the method immediately returns S_FALSE without playing the requested sound.

If the specified sound cannot be found, IUserNotification2::PlaySound uses the system default sound.

See Also

IUserNotification::PlaySound