1

我使用媒体控制器 DLL 创建了 mp3 播放器。但是当我运行这个时,我的程序类显示错误“输入字符串格式不正确”这里我描述了我的代码

    private void PlayMusicFile()
    {
        if (FoundIt)
        {
            this.SetButtons(true);
            if (MyPlayer.bFileIsOpen)
            {
                MyPlayer.Close();
            }

            MyPlayer.Open(MusicFileName);

            if (MyPlayer.bFileIsOpen)
            {
                imgIndex = 0;
                MyPlayer.Play();
                Muted = false;
                DancePic.Visible = true;
                btnMute.Text = "Mute";
                this.tbPosition.Maximum = MyPlayer.Duration();
                this.lblDuration.Text = MyPlayer.TimeCalculation(MyPlayer.Duration());
                this.tbVolume.Maximum = 1000;
                this.tbVolume.Value = MyPlayer.Volume;
            }
        }
    }

我还使用了另一种方式 [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);

但是两者都不起作用 mciSendString("open \"" + p3 + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero); mciSendString("播放媒体文件", null, 0, IntPtr.Zero);

4

0 回答 0