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

New Topic/Question
Reply




MultiQuote



|