Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/11/2011, 16:18
Avatar de JxDarkAngel
JxDarkAngel
 
Fecha de Ingreso: septiembre-2009
Mensajes: 82
Antigüedad: 14 años, 7 meses
Puntos: 2
Respuesta: C sharp Al hacer clic boton, reprodusca un sonido.

PARA REPRODUCIR UN SONIDO, PUEDES OCUPAR LA SIGUIENTE API, DONDE EN ESTE CASO SOLO NECESITAS LLAMAR AL METODO Reproducir(<RutaArchivo>) Y PASARLE LA RUTA DEL ARCHIVO QUE QUIERES REPRODUCIR

[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);

private string RutaCancion=@"C:\Cancion.mp3";


private void Reproducir(string RutaArchivo)
{
string Comando = string.Format("OPEN \"{0}\" "
+ " TYPE mpegvideo "
+ " ALIAS MediaFile ", RutaArchivo);
mciSendString(Comando, null, 0, IntPtr.Zero);

//Reproducir el archivo abierto
Comando = "PLAY MediaFile ";
mciSendString(Comando, null, 0, IntPtr.Zero);
}