Επεξεργασία

Κοινή χρήση μέσω


IUserNotification::PlaySound method (shobjidl_core.h)

Plays a sound in conjunction with the notification.

Syntax

HRESULT PlaySound(
  [in] LPCWSTR pszSoundName
);

Parameters

[in] pszSoundName

Type: LPCWSTR

A pointer to a null-terminated Unicode string that specifies the alias of the sound file to play.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The string pointed to by pszSoundNamepqc 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 IUserNotification::PlaySound with pszSoundNamepqc 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, IUserNotification::PlaySound uses the system default sound.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)