0

我的 form1 设计器中有一个菜单条。在表格 1 的顶部:

视频是 Microsoft.Directx.AudioVideoPlayBack.Video

Video vdo;

然后在 menustrip 打开菜单点击事件:

private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (vdo != null)
            {
                vdo.Stop();
                timer1.Stop();
                vdoTrackBar.Value = 0;

            }
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.ShowDialog();
            openFileDialog1.Title = "Select video file..";
            openFileDialog1.InitialDirectory = Application.StartupPath;
            openFileDialog1.DefaultExt = ".avi";
            openFileDialog.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
            if (openFileDialog1.FileName != "")
            {
                Form1.ActiveForm.Text = openFileDialog.FileName + " - Anand Media Player";
                vdo = new Video(openFileDialog.FileName);

                vdo.Owner = this;
                Duration = CalculateTime(vdo.Duration);
                PlayingPosition = "0:00:00";
                textStatus.Text = PlayingPosition + "/" + Duration;

                vdoTrackBar.Minimum = 0;
                vdoTrackBar.Maximum = Convert.ToInt32(vdo.Duration);
            }
        }

尝试在线打开视频文件时出现错误/异常:

vdo = new Video(openFileDialog.FileName);

这是我得到的错误异常,我试图用谷歌搜索,但我还不明白我应该怎么做才能修复它,而且我没有在我的项目中使用 Microsoft 目录中的 Microsoft.DirectX.dll:

托管调试助手“LoaderLock”在“C:\Users\bout0_000\Documents\Visual Studio 2013\Projects\DateCounter\DateCounter\bin\Debug\Battlefield1_ReleaseDateCounter.vshost.exe”中检测到问题。

附加信息:DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll' 正在尝试在 OS Loader 锁定内进行托管执行。不要尝试在 DllMain 或图像初始化函数中运行托管代码,因为这样做会导致应用程序挂起。

如果有这个异常的处理程序,程序可以安全地继续。

4

0 回答 0