I am in the pro开发者_StackOverflow社区cess of writing a basic video player program. I found this tutorial online, which is exactly the kind of help I was looking for -- except, the tutorial was written for .net 2.0.
This means, for instance, when I originally tried to run the finished program, I got a runtime error identical to this question. I fixed that as per the accepted answer, but now I get a new bug:
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.
Is there a way to update this tutorial code into something that works with .net 4.0? Or am I better off just finding a new tutorial that's more up-to-date?
The obsolete managed DirectX wrappers do indeed generate this warning. It is a false warning, the CLR is already loaded. Debug + Exceptions, expand the Managed Debugging Assistants node and untick LoaderLock.
I suggest to use AForge.NET which wraps FFMPEG library so you can work with many kind of video files in C#. Don't use DirecX, use http://www.aforgenet.com/framework/downloads.html Building with this framework video player is simple and you don't waste time.
精彩评论