C#: Form: DirectX Crash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pni8ac
    New Member
    • Jul 2008
    • 3

    C#: Form: DirectX Crash

    Hi,

    I have a software that read video with DirectX, AudioVideoPlayb ack.
    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
    Code:
                    playerVideo = new Video(media);
                    playerVideo.Owner = pnlVideo;
                    pnlVideo.Visible = true;
                    picVideoX.Visible = true;
                    if (playerVideo.DefaultSize.Height < 30 && playerVideo.DefaultSize.Width < 30)
                    {
                        pnlVideo.Size = playerVideo.DefaultSize;
                    }
                    else
                    {
    
                        if (playerVideo.DefaultSize.Width < playerVideo.DefaultSize.Height)
                            pnlVideo.Size = playerVideo.Size = new Size(350, (350 * playerVideo.DefaultSize.Height) / playerVideo.DefaultSize.Width);
                        else
                            pnlVideo.Size = playerVideo.Size = new Size((350 * playerVideo.DefaultSize.Width) / playerVideo.DefaultSize.Height, 350);
                    }
                    pnlVideo.Left = (this.Width / 2) - (pnlVideo.Width / 2);
                    pnlVideo.Top = (this.Height / 2) - (pnlVideo.Height / 2);
                    picVideoX.Top = pnlVideo.Top - picVideoX.Height;
                    picVideoX.Left = pnlVideo.Left + pnlVideo.Width - picVideoX.Width;
                    playerVideo.Play();
    And here my code to stop it:
    Code:
                    if (playerVideo != null ? (playerVideo.Disposed == false ? playerVideo.Playing : false) : false)
                    {
                        playerVideo.Stop();
                        picVideoX.Visible = false;
                        pnlVideo.Visible = false;
                        playerVideo.Dispose();
                    }
    Anyone have a idea why it crash like that?
    Last edited by Curtis Rutland; Jul 16 '08, 02:30 PM. Reason: Added Code Tags - Please use the # button
Working...