Hi,
I've got problem with playing sounds from windows.form program that contains folder sounds with 1 sound.wav
spWave.SoundLocation = "sounds/blue_buff.wav";
spWave.Play();
This patch saying is wrong and program crash ... any ideas?
4 replies to this topic
#1
Posted 27 June 2011 - 04:08 PM
|
|
|
#2
Posted 29 June 2011 - 11:15 AM
My first doubt is on the location variable. To be sure, Hard code the full absolute path starting from drive letter like "c:...".
Your current working directory depends upon what type of project you have created. Using Visual studio might be different from others.
Also there is very little reference to the rest of your code i.e. if the class type of spWave is correct etc.
Your current working directory depends upon what type of project you have created. Using Visual studio might be different from others.
Also there is very little reference to the rest of your code i.e. if the class type of spWave is correct etc.
Today is the first day of the rest of my life
#3
Posted 30 June 2011 - 08:01 AM
and what is the class for mp3 files???
#4
Posted 30 June 2011 - 02:33 PM
here is simple mp3 player u can look on it and use it
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace mp3_player
{
public partial class Form1 : Form
{
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public Form1()
{
InitializeComponent();
}
private void wybierz_Click(object sender, EventArgs e)
{
if (fileopen.ShowDialog() == DialogResult.OK)
{
nazwa_piosenki.Text = fileopen.FileName; //name of song aka location of it
Play.Enabled = true;
}
}
private void Play_Click(object sender, EventArgs e)
{
mciSendString("open \"" + nazwa_piosenki.Text + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);
mciSendString("play MediaFile", null, 0, IntPtr.Zero);
Play.Enabled = false;
stop.Enabled = true;
}
private void stop_Click(object sender, EventArgs e)
{
mciSendString("close MediaFile", null, 0, IntPtr.Zero);
stop.Enabled = false;
Play.Enabled = true;
}
}
}
#5
Posted 30 June 2011 - 04:35 PM
is this a syntax for using some dll???
and what about that dll??? does it contain some classes and methods like SDK's???
and does that dll must be inside my project in specific file or not???
[DllImport("winmm.dll")]
and what about that dll??? does it contain some classes and methods like SDK's???
and does that dll must be inside my project in specific file or not???
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









