Playsound loop not working  
Author Message
tamarind





PostPosted: Visual C# General, Playsound loop not working Top

I need to play a .wav file over and over again. I am using the
following code.

[DllImport("winmm.dll")]
private static extern bool PlaySound( string lpszName, int hModule, int
dwFlags );

public int SND_ASYNC = 0x0001;
public int SND_LOOP = 0x0008;

PlaySound( wavfile, 0, (SND_ASYNC | SND_LOOP));

But it plays only once and stop. Any idea what's wrong

Thanks in advance.



Visual C#17  
 
 
ahmedilyas





PostPosted: Visual C# General, Playsound loop not working Top

why dont you use the .NET 2.0 SoundPlayer class in the System.Media namespace It has a method called PlayLooping

 
 
cablehead





PostPosted: Visual C# General, Playsound loop not working Top

This works in VB so it should go:

Add -

public int SND_NODEFAULT = 0x0002;

SND_LOOP || SND_ASYNC || SND_NODEFAULT