开发者

Windows Form won't show with DirectX.AudioVideoPlayback - C#

I'm trying to make a media player application wit开发者_开发问答h DirectX.AudioVideoPlayback, but when I try to run it, the project builds successfully and the application runs, but the Form doesn't show. The application just hangs on Application.Run(). However, when I comment out all of the DirectX code, the application runs like it is supposed to.

Here is my code:

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();
}


I have used this DLL before. When I attempt to open a media file, Visual Studio throws this exception:

DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

I suggest you using another library. Take a look here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜