zoukankan      html  css  js  c++  java
  • 使用wmp控件连续播放多个声音文件的代码(计算机报时程序C#)

                WMPLib.IWMPPlaylist pl = this.axWindowsMediaPlayer1.playlistCollection.newPlaylist("mylist");
                WMPLib.IWMPMedia im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia("T.wav");
                pl.appendItem(im1);
                DateTime dt = DateTime.Now;
               
               
                int h = dt.Hour;
                if (h > 9)
                {
                    int s = h / 10;
                    int g = h % 10;
                    string sw = s.ToString() + "0";
                    im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia(sw + ".wav");
                    pl.appendItem(im1);
                    if (g != 0)
                    {
                        im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia(g + ".wav");
                        pl.appendItem(im1);
                    }
                }
                else
                {

                    string hh = h.ToString();
                    im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia(hh+".wav");
                    pl.appendItem(im1);
                }
                im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia("d.wav");
                pl.appendItem(im1);


                int m = dt.Minute;
                if (m > 9)
                {
                    int s = m / 10;
                    int g = m % 10;
                    string sw = s.ToString() + "0";
                    im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia(sw + ".wav");
                    pl.appendItem(im1);
                    if (g != 0)
                    {
                        im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia(g + ".wav");
                        pl.appendItem(im1);
                    }
                }
                else
                {

                    string hh = m.ToString();
                    im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia( "0.wav");
                    pl.appendItem(im1);
                    im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia(hh + ".wav");
                    pl.appendItem(im1);
                }
                im1 = (WMPLib.IWMPMedia)this.axWindowsMediaPlayer1.newMedia("m.wav");

                pl.appendItem(im1);
                this.axWindowsMediaPlayer1.currentPlaylist = pl;

  • 相关阅读:
    USACO 1.1-ride
    USACO 1.1-gift1
    USACO 1.1-Friday the Thirteenth
    SQL详解(上)
    Python入门神图
    JSTL标签详解以及应用实例
    EL表达式详解及应用实例
    session应用----登录验证小案例
    各种编码问题产生原因以及解决办法---------响应编码,请求编码,URL编码
    Servlet的request应用案例
  • 原文地址:https://www.cnblogs.com/ahuang1118/p/1193894.html
Copyright © 2011-2022 走看看