473,378 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

C#: Form: DirectX Crash

3
Hi,

I have a software that read video with DirectX, AudioVideoPlayback.
When I open 4 or 5 instance of the my software, and I load different video, everything work great, but if I stop a divx video, I got a blue screen.

There my code to play the video:
media is a string to the video's path, and everything is in a try/catch
Expand|Select|Wrap|Line Numbers
  1.                 playerVideo = new Video(media);
  2.                 playerVideo.Owner = pnlVideo;
  3.                 pnlVideo.Visible = true;
  4.                 picVideoX.Visible = true;
  5.                 if (playerVideo.DefaultSize.Height < 30 && playerVideo.DefaultSize.Width < 30)
  6.                 {
  7.                     pnlVideo.Size = playerVideo.DefaultSize;
  8.                 }
  9.                 else
  10.                 {
  11.  
  12.                     if (playerVideo.DefaultSize.Width < playerVideo.DefaultSize.Height)
  13.                         pnlVideo.Size = playerVideo.Size = new Size(350, (350 * playerVideo.DefaultSize.Height) / playerVideo.DefaultSize.Width);
  14.                     else
  15.                         pnlVideo.Size = playerVideo.Size = new Size((350 * playerVideo.DefaultSize.Width) / playerVideo.DefaultSize.Height, 350);
  16.                 }
  17.                 pnlVideo.Left = (this.Width / 2) - (pnlVideo.Width / 2);
  18.                 pnlVideo.Top = (this.Height / 2) - (pnlVideo.Height / 2);
  19.                 picVideoX.Top = pnlVideo.Top - picVideoX.Height;
  20.                 picVideoX.Left = pnlVideo.Left + pnlVideo.Width - picVideoX.Width;
  21.                 playerVideo.Play();
  22.  
And here my code to stop it:
Expand|Select|Wrap|Line Numbers
  1.                 if (playerVideo != null ? (playerVideo.Disposed == false ? playerVideo.Playing : false) : false)
  2.                 {
  3.                     playerVideo.Stop();
  4.                     picVideoX.Visible = false;
  5.                     pnlVideo.Visible = false;
  6.                     playerVideo.Dispose();
  7.                 }
  8.  
Anyone have a idea why it crash like that?
Jul 16 '08 #1
0 1005

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
9
by: Mike P | last post by:
Problems, problems... Im trying to create DirectX Projects within C# and to also look at the latest DirectX C# Samples. I have just installed MS Visual C# .net Standard Edition on my Windows...
1
by: Michael | last post by:
Hello I've only code for VB5 which doesn't seem to work in NET. Anyone could help me out here? Simply for outputting a video any format to a form in a Visual Basic.NET program or maybe...
0
by: Harvey Cohen | last post by:
Hello all, I have some C# code that implements calls to DirectX.DirectSound. It compiles under both VS .NET 2003 and VS 2005 and runs under VS .NET 2003 and VS 2005 on a Compaq laptop (Windows...
3
by: Alun Harford | last post by:
I'm trying to learn to use DirectX in C#, but all of the examples I've found so far are pretty unstable (crash when minimized, crash when the window is resized so its height is 0 pixels, crash on...
11
by: raylopez99 | last post by:
I just downloaded the apparently free SDK for DirectX 9, all 200+ MB of it, but as I read about WPF I wonder: is DirectX obsolete? Should I even bother learning how to use it? After all, the end...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.