System.Sound.playSound method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Plays a sound file.

Syntax

strRetVal = System.Sound.playSound(
  strSound
)

Parameters

strSound [in]

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 [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)