我试图用DirectX.AudioVideoPlayback制作一个媒体播放器应用程序,但当我尝试运行它时,项目成功构建,应用程序运行,但窗体不显示。应用程序在Application.Run()上挂起。然而,当我注释掉所有的DirectX代码时,应用程序就可以正常运行了。
下面是我的代码:
Video v_Video = null;
void MainFormLoad(object sender, EventArgs e)
{
v_Video.Size = VideoViewer.Size; //VideoViewer is a PictureBox
v_Video.Owner = VideoViewer;
}
void PlayButtonClick(object sender, EventArgs e)
{
v_Video = new Video(File.ReadAllText("VideoLocation.txt") + "\\Video.wmv");
v_Video.Play();
PauseButton.BringToFront();
}发布于 2011-10-06 21:40:21
我以前用过这个DLL。当我尝试打开媒体文件时,Visual Studio抛出此异常:
'C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll‘正在尝试在OS加载器锁中托管执行
DLL。不要试图在DllMain或图像初始化函数中运行托管代码,因为这样做可能会导致应用程序挂起。
我建议您使用其他库。看看here吧。
https://stackoverflow.com/questions/7674983
复制相似问题