Question DirectX Loaderlocker problem

Joined
Feb 16, 2011
Messages
9
Programming Experience
Beginner
Hello,

Ive been looking whole google for my problem and find a few awnsers like disable the mda in the debug exceptions but none solved my problem.

Im working with Visual Studio 2010 Professional

Piece of the code:
VB.NET:
Imports System.Configuration
Imports Microsoft.DirectX.AudioVideoPlayback

---- ive cut the main part out of this code ----

Public Class Game

    Public Sub New()
        Dim videoFile As New Microsoft.DirectX.AudioVideoPlayback.Video(fileName:=".\movies\test.avi")
        videoFile.Owner = ArtificialLife.GamePanel
        videoFile.Play()
    End Sub
End Class

Now the problem occures at the "Dim videoFile As New Microsoft.DirectX.AudioVideoPlayback.Video(fileName:=".\movies\test.avi")" part.

The error im getting is this:
VB.NET:
(rough google translation dutch - english)
LoaderLock was detected:
Message: Trying dll C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll to introduce guidance inside OS Loader lock. Do not attempt to execute code with guidance within a DllMain or pictureinitialisationfunction, because this application may crash.

Hope I've provided enough information, if not, please ask.

Thanks for helping :)
 

Unfortunatly that solution completely filled googles search results and ive tried it many times.
Any time I try that solution the application throws a new debug message but without any information (just a general one), like included below

VB.NET:
System.InvalidOperationException was unhandled
Message = An error occurred while creating the form. See exception inner exception for details. The error is: Error in the application.
  Source=ArtificialLife
  StackTrace:
       at WindowsApplication1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:regel 190
       at WindowsApplication1.My.MyProject.MyForms.get_ArtificialLife()
       at WindowsApplication1.My.MyApplication.OnCreateMainForm() in C:\Users\---\Desktop\My Dropbox\School\---\Visual Basic Opdrachten\Artificial Life\ArtificialLife\My Project\Application.Designer.vb:regel 35
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:regel 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Microsoft.DirectX.DirectXException
       Message=Error in the application.
       Source=Microsoft.DirectX.AudioVideoPlayback
       ErrorCode=-2147220970
       ErrorString=VFW_E_NOT_FOUND
       StackTrace:
            at Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName, Boolean autoRun)
            at Microsoft.DirectX.AudioVideoPlayback.Video..ctor(String fileName)
            at WindowsApplication1.Game..ctor() in C:\Users\---\Desktop\My Dropbox\School\---\Visual Basic Opdrachten\Artificial Life\ArtificialLife\Form1.vb:regel 51
            at WindowsApplication1.ArtificialLife..ctor() in C:\Users\---\Desktop\My Dropbox\School\---\Visual Basic Opdrachten\Artificial Life\ArtificialLife\Form1.vb:regel 11
       InnerException:

Any other suggestions or alternatives for playing an video in a Picturebox (or other design element)?
 
Last edited:
Unfortunatly that solution completely filled googles search results and ive tried it many times.
I think it should be obvious then that you told so in the first place.
 
Oh, I'm sorry I missed that. Perhaps it was the lack of proper casing that caused it to not stand out for me... Since that seems to be the solution you're right it completely fills the search results. I'm not even sure it is possible to do using exclusive search terms, since most possible other solutions would probably include the obvious as well. Well, at least you got a thread bump :)
 
I know of the WMP component that you can add to a form to display video. Toolbox > Choose Items > COM Components > Windows Media Player.
Others seems to successfully use the DirectX.AudioandVideoPlayback when they turn off the MDA notification (when debugging), but I've never tried it.
 
Back again, Ive tried your method, however Im unable to find any windows media player (or similar) component.
Could it be that this has been removed in visual studio 2010 pro?

Im out of idea's, seems ive just got to wait until microsoft fixes this bug
 
Could it be that this has been removed in visual studio 2010 pro?
It is there if Windows has WMP installed. Or else there is an error in your VS installation.
 
After long amounts of searching I finally found a script which fixed the job! :)

First add this to your code:
VB.NET:
Imports Microsoft.DirectX, Microsoft.DirectX.AudioVideoPlayback
Then add references to DirectX and DirectX.AudioVideoPlayback

When done, add this code:
VB.NET:
        Dim mVideo As Microsoft.DirectX.AudioVideoPlayback.Video
        mVideo = New Microsoft.DirectX.AudioVideoPlayback.Video("somevideo.avi") 'Load the file  
        mVideo.Owner = Me.GamePanel 'Show in the picturebox
        mVideo.Play()

And that will do the trick :)

Thanks for helping though, hope I can help others with the same problem like this with this piece of code.
 
You do realize that is exactly the same code as in your first post?
 
it isnt, the first time i did this:
VB.NET:
Dim videoFile As New Microsoft.DirectX.AudioVideoPlayback.Video(fileName:=".\movies\test.avi")

Apparently that had to be:
VB.NET:
Dim mVideo As Microsoft.DirectX.AudioVideoPlayback.Video
mVideo = New Microsoft.DirectX.AudioVideoPlayback.Video("somevideo.avi")

I think that is because you cant instantly define the video you want to load
 
No, those code lines are equivalent, there is no practical difference. One is just a short version of the other.
 
Back
Top