<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 消費(fèi)電子 > 設(shè)計(jì)應(yīng)用 > C#中用API實(shí)現(xiàn)MP3等音頻文件的播放類

          C#中用API實(shí)現(xiàn)MP3等音頻文件的播放類

          作者: 時(shí)間:2009-06-15 來(lái)源:網(wǎng)絡(luò) 收藏

          public void StopT()

          {

            TemStr = ;

            TemStr = TemStr.PadLeft(128,Convert.ToChar( ));

            ilong = Class.mciSendString(close media, TemStr, 128, 0);

            ilong = Class.mciSendString(close all, TemStr, 128, 0);

            mc.state = State.mStop ;

          }

          public void Puase()

          {

            TemStr = ;

            TemS

          tr = TemStr.PadLeft(128,Convert.ToChar( ));

            ilong = Class.mciSendString(pause media, TemStr, TemStr.Length, 0);

            mc.state = State.mPuase ;

          }

          private string GetCurrPath(string name)

          {

            if(name.Length 1) return ;

            name = name.Trim();

            name = name.Substring(0,name.Length-1);

            return name;

          }

          //總時(shí)間

          public int Duration

          {

            get

            {

          durLength = ;

          durLength = durLength.PadLeft(128,Convert.ToChar( )) ;

          APIClass.mciSendString(status media length, durLength, durLength.Length, 0);

          durLength = durLength.Trim();

          if(durLength == ) return 0;

          return (int)(Convert.ToDouble(durLength) / 1000f);

            }

          }

          //當(dāng)前時(shí)間

          public int CurrentPosition

          {

            get

            {

          durLength = ;

          durLength = durLength.PadLeft(128,Convert.ToChar( )) ;

          APIClass.mciSendString(status media position, durLength, durLength.Length, 0);

          mc.iPos = (int)(Convert.ToDouble(durLength) / 1000f);

          return mc.iPos;

            }

          }

            }

            public class APIClass

            {

          [DllImport(kernel32.dll, CharSet = CharSet.Auto)]

          public static extern int GetShortPathName (

            string lpszLongPath,

            string shortFile,

            int cchBuffer

          );

          [DllImport(winmm.dll, EntryPoint=mciSendString, CharSet = CharSet.Auto)]

          public static extern int mciSendString (

            string lpstrCommand,

            string lpstrReturnString,

            int uReturnLength,

            int hwndCallback

          );

            }

          }


          上一頁(yè) 1 2 下一頁(yè)

          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();