Share via


System.Sound.playSound Method

Plays a sound file.

Syntax

retVal = System.Sound.playSound(
  strSound
)

Parameters

  • strSound [in]
    BSTR Sets String that specifies the UNC path to the sound file. The maximum length, including the null terminator, is 256 characters.

Remarks

playSound is asynchronous; to stop the currently playing sound, call playSound with strSound set to null.

The sound is assigned to the system notification volume control.

Examples

The following example demonstrates how to play a sound file.

<script>
var mytext = "Sound: chimes.wav";

// --------------------------------------------------------------------
// Initialize the gadget.
// --------------------------------------------------------------------
function Init()
{    
    gadgetContent.innerText = mytext;
    System.Sound.playSound("\\windows\\media\\chimes.wav");
}
</script>
    
</head>
<body onload="Init()">
    <span id="gadgetContent"></span>
</body>
</html>

Requirements

Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
IDL Sidebar.idl
DLL Sidebar.Exe version 1.00 or later

See Also

System.Sound

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK