I found my answer--it really is very simple! Thanks to Peter Bromberg for
steering me in the right direction.
To use the .NET 2.0 SoundPlayer class with a project resource, you simply
call the resource by name, without quotes. Here is a complete example:
1) Create a new .NET 2.0 console application.
2) Right-click the project's Properties icon and select 'Open' from the
contect menu that appears.
3) Select the Resources tab of the project's properties pages. If the
Resources page says you don't have a default resources file, click on the
link on the page to create one. Ignore the blank string resource it shows
you.
4) In the property page toolbar, select 'Add Resource' > 'Add existing
file...' Navigate to 'c:\windows\media\notify.wav' and open it. The first
button on the Resources page toolbar should now say 'Audio', and the
property page should show a Windows Media document icon named 'notify'.
5) Replace all code in Program.cs with the code shown below.
6) Run the application. The Windows 'notify' sound should play as soon as
the program launches. Hit any key to exit the program.
7) You can use any sound added as a project resource by simply specifying
it, using the 'Project.Resources' syntax shown in the code. In VS.NET,
Intellisense will show the list of available resources.
using System;
using System.Collections.Generic;
using System.Text;
using System.Media;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SoundPlayer sound = new
SoundPlayer(Properties.Resources.notify);
sound.Play();
Console.ReadKey();
}
}
}