Results 1 to 2 of 2

Thread: SoundPlayer constructor

  1. #1

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    SoundPlayer constructor

    I'm trying to figure out how to play a .wav file that's in my Resources folder.

    I searched the forum an checked out MSDN, and now I'm really confused. Here's the MSDN example.

    The MSDN example has a constructor with 2 args, but that signature doesn't match the SoundPlayer constructor that takes 2 args.

    Does anyone have a working example of this?

    Thanks,
    Mike

  2. #2

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Re: SoundPlayer constructor

    I guess the documentation is off, I gave up on the two arg constructor. To play a .wav that's a resource, I'm using this (.Reminder is Reminder.wav I added to the resources.

    Code:
    Stream s = PCMessengerModule.Properties.Resources.Reminder;
    SoundPlayer pl = new SoundPlayer(s);
    pl.Play();
    s.Close();
    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width