1
Interesting...
I never got a chance to work on such a project. I need to try it out.
Sharing some links, hopes it helps you...
http://stackoverflow.com/questions/3502311/how-to-play-a-sound-in-c-net
http://stackoverflow.com/questions/21331412/best-way-to-use-the-system-media-soundplayer-class
Here suggesting not to use SoundPlayer due to memory issue...
http://stackoverflow.com/questions/4107886/soundplayer-causing-memory-leaks
http://www.codeproject.com/Articles/13909/SoundPlayer-bug-Calling-unmanaged-APIs
0
Hi, thanks a lot,
some of those links were realy heplful! Even though I am still not sure why such a problem might even arise, I guess loading from a file seems to solve it, which is enough for the moment ;)
One last question, since this "problem" got me a little hyper nervous regarding memory leaks...
If I have 2 picture resources Pic1 and Pic2 and an ImageButton-Object, which is just some object inherited from UserControl and with a changed OnPaint:
01 | protected override void OnPaint(PaintEventArgs e) |
06 | { this .imageButton.DefaultImage = Resource1.Pic1; } |
08 | { this .imageButton.DefaultImage = Resource1.Pic2; } |
09 | e.Graphics.DrawImage( this .defaultImage, this .ClientRectangle); |
Beside OnPaint not being a good place for assigning DefaultImage (its just here to show you what I mean in a short piece of code), I am just assinging a reference to my precompiled resource here, am I? I am not creating a copy as I would if I would call it with "new Bitmap(Resource1.Pic1)".
So if I change keyStatus every 5 seconds, I would have a very annoying picture on my screen with a lot of chaning, but no problems that the picture changing leaks memory. Correct?
Again, thanks a lot!
Cheers Stefan
