Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am getting error on this 12t line
using Microsoft.DirectX.AudioVideoPlayback;

namespace VideoTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Video ourVideo = new Video(@"E:\Iron Man Series\1.Iron.Man.2008.1080p.BluRay.x264.anoXmous.mp4");
        }
    }
}

Error :-
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.

how to solve this?

Note:"Video" is a predefined word and not a control. So, which control to use to display the video.
Posted
Updated 20-Feb-14 22:14pm
v2
Comments
ZurdoDev 20-Feb-14 8:17am    
Sounds like it doesn't like what you are trying to do.
agent_kruger 20-Feb-14 8:18am    
:laugh. sir, please tell me were am i going wrong.
ZurdoDev 20-Feb-14 8:22am    
Sorry. I have no idea. My guess is there are lots of samples online of how to play video in C# winform. Looking at the error the problem might just be that you are calling it inside of Form1_Load. I would google the error and see what I get.
agent_kruger 20-Feb-14 8:24am    
yes, i have already got one from code project itself but it is filled with so much stuff that it needs a week to be understood.
agent_kruger 20-Feb-14 8:25am    
and sir, no basic program to run video found.

1 solution

What about adding a button on the form, and playing the video from the button click event handler, does that work?
Otherwise, try a WTF: change the debugger options, as described in e.g. http://stackoverflow.com/questions/56642/loader-lock-error[^]
 
Share this answer
 
Comments
agent_kruger 21-Feb-14 4:11am    
sir, the code is already written on the button click event and after removing loader lock option it says "Error in the application."
agent_kruger 21-Feb-14 4:13am    
and one more thing, sir, "Video ourVideo = new Video(@"E:\Iron Man Series\1.Iron.Man.2008.1080p.BluRay.x264.anoXmous.mp4");" in the above line "Video" is a predefined word and not a control. So, which control to use to display the video.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900