|
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;
namespace MCIDEMO
{
public partial class Form2 : Form
{
// Declare the nofify constant
public const int MM_MCINOTIFY = 953;
public const int MCI_NOTIFY_SUCCESSFUL = 1;
public const int NOTIFY_ABORTED = 4;
public Form parent;
protected override void WndProc(ref Message m)
{
if (m.Msg == MM_MCINOTIFY)
{
// The file is done playing, do whatever
System.Diagnostics.Debug.WriteLine(m.ToString());
foreach (Form1.ListItem itm in ((Form1)this.parent).listBox1.Items)
{
if (itm.DeviceId == (int)m.LParam)
{
//To handle wav file play looping
if (
(itm.Filename.Substring(itm.Filename.Length - 4).ToUpper() == ".WAV")
&& ((int)m.WParam == MCI_NOTIFY_SUCCESSFUL)
&& (itm.Playlooping)
)
{
MciPlayer p = new MciPlayer();
p.Alias = itm.Alias;
p.Isloaded = true;
p.PlayFromStart(this.Handle);
break;
}
else
{
listBox1.Items.Add(DateTime.Now.ToString() + " " + (string)itm.Filename);
break;
}
}
}
}
base.WndProc(ref m);
}
public Form2()
{
InitializeComponent();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Coder. Hacker. Fixer.