0
votes

When I run the Release for this code on any computer other than mine, I get the "Has Stopped Working" Error: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.DirectX.DirectSound; using Microsoft.DirectX.AudioVideoPlayback; using Microsoft.DirectX; using System.Diagnostics;

namespace Picture_Button
{
    public partial class Form1 : Form
    {
        Video video = new Video("C:\\Users\\Pushkin\\Desktop\\PPAP.mp4");
        //Video video = new Video("C:\\Users\\Pushkin\\Desktop\\PPAP.mp4");
        private int clicks = 0;
        public Form1()
        {
            InitializeComponent();
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            video.Ending += new System.EventHandler(this.Video_Ending);
            //video.Ending += Video_Ending;
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            clicks++;
        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            switch (clicks)
            {
                case 0: pictureBox1.Image = Properties.Resources.Pineapple; break;
                case 1: pictureBox1.Image = Properties.Resources.Apple; break;
                case 2: pictureBox1.Image = Properties.Resources.Pen; break;
                case 3:
                    {
                        video.Owner = this;
                        video.Play();
                        /*video.Dispose();
                        Application.Exit();*/
                    }
                    break;
            }
        }
        private void Video_Ending(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            video.Dispose();
            Application.Exit();
        }
    }
}

Any ideas to why this happens?

1
Please check the Windows Event Log. You will most likely find a more detailed error message there. Post it here as part of the questionNineBerry

1 Answers

0
votes

here are the steps I would do to figure out the problem:

  1. Check if the video is present on the pc.
  2. Add a try catch block and check the output of the Exception.