3 Replies - 2763 Views - Last Post: 08 January 2012 - 05:53 AM Rate Topic: -----

#1 madmorgan  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 07-May 10

Loader Lock Exception while trying to play video using DirectX

Posted 08 January 2012 - 03:31 AM

Hello all,

Im trying to use DriectX 9 SDK to play a video, Im also using .Net 4 with Visual Studio 2010. I do have the following refances to DirectX AudioVideoPlayback and DirectX. I get the following error when running my code.

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

here is my code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Microsoft.DirectX.AudioVideoPlayback;
using Microsoft.DirectX;

namespace test
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int w = panel1.Width;
            int h = panel1.Height;

            try
            {
                Video test = new Video(@"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv", false); //BREAKES HERE
                test.Owner = panel1;
                panel1.Size = new Size(w, h);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
    }
}



App config file details

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>



I have also turned off the LoaderLock in the Exceptions Menu. then I just get a generic error.

MESSAGE > Error in the application.
SOURCE > Microsoft.DirectX.AudioVideoPlayback
STACK TRACE > at Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName, Boolean autoRun)
at Microsoft.DirectX.AudioVideoPlayback.Video..ctor(String fileName, Boolean autoRun)
at test.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\SkyNet\Documents\Visual Studio 2010\Projects\test\test\Form1.cs:line 30

This post has been edited by madmorgan: 08 January 2012 - 03:32 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Loader Lock Exception while trying to play video using DirectX

#2 TheCompBoy  Icon User is offline

  • D.I.C Regular

Reputation: 11
  • View blog
  • Posts: 314
  • Joined: 21-April 11

Re: Loader Lock Exception while trying to play video using DirectX

Posted 08 January 2012 - 04:14 AM

I think that this thread should be able to help you: http://www.dreaminco...an-application/
Was This Post Helpful? 0
  • +
  • -

#3 madmorgan  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 07-May 10

Re: Loader Lock Exception while trying to play video using DirectX

Posted 08 January 2012 - 04:23 AM

I all ready looked on that topic for information but cant fix my error.
Was This Post Helpful? 0
  • +
  • -

#4 madmorgan  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 07-May 10

Re: Loader Lock Exception while trying to play video using DirectX

Posted 08 January 2012 - 05:53 AM

Ok I have seemed to have fixed the probelm. I added refance to the Microsoft.AudioVideoPlayback.dll but then I added a refance to Microsoft.DirectX.dll and every thing seems to work now.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1