Click here to Skip to main content
15,885,141 members
Articles / Programming Languages / Visual Basic

Fun with Sound

Rate me:
Please Sign up or sign in to vote.
4.92/5 (25 votes)
10 Jul 2014CPOL5 min read 42.2K   2.2K   53  
Playing your favorite music and sound files all at once
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 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());

                listBox1.Items.Add(DateTime.Now.ToString() + " " + (string) this.Tag);
                this.Tag = null;
                
            }

            base.WndProc(ref m);
        }


        public Form2()
        {
            InitializeComponent();
        }
    }
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Singapore Singapore
Coder. Hacker. Fixer.

Comments and Discussions