-1

I am having trouble getting a screen capture program to work that I am trying to replicate from a YouTube video. the picture is the error I am getting and my code is supplied. I do not believe my error is in my code I think there is a file I am supposed to run or add somewhere but I can not figure out what I need to do.

IMMAGE OF ERROR WHEN HITTING BUTTON 1 (START BUTTON)

IMMAGE OF THE ERROR WHEN THE PROGRAM IS PUBLISHED

  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 VisioForge.Types.OutputFormat;


namespace SCREEN_RECORDER_V2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            videoCapture1.Screen_Capture_Source = new
                            VisioForge.Types.Sources.ScreenCaptureSourceSettings()
            { FullScreen = true };

            videoCapture1.Audio_PlayAudio = videoCapture1.Audio_RecordAudio = false;

            videoCapture1.Output_Format = new VFAVIOutput();

            videoCapture1.Output_Filename = Environment.GetFolderPath
                (Environment.SpecialFolder.MyVideos) + "\\output.avi";

            videoCapture1.Mode = VisioForge.Types.VFVideoCaptureMode.ScreenCapture;

            videoCapture1.Start();

        }

        private void button2_Click(object sender, EventArgs e)
        {
            videoCapture1.Stop();

        }
    }
}
BigRed
  • 1
  • 1

1 Answers1

-1

Based on my test, I reproduced your problem in the picture. After some attempts, I can capture the screen successfully.

First, you could download x64 or x86 exe both by clicking Base package->x64 or x86 in the picture you provided.

Second, please run as administrator to the run the exe.

Third, please install the nuget-package SDK redist base package x86 or x64 and Video Capture SDK redist package x86 or x64.

Finally, after publish the program or directly click the button1 to start the record.

Jack J Jun
  • 5,633
  • 1
  • 9
  • 27
  • I have added another picture of the error when the program is published. i am still unable to get the program to function. – BigRed Jul 12 '21 at 22:02
  • @BigRed, I have updated my answer-> Third. Based on my test, there is no error in current project or published project after I add the above nuget-packages. – Jack J Jun Jul 13 '21 at 02:46
  • Is there a certain place I can add these files to my program? When I run them and rebuild and publish the project I am getting the same error. Even when I run the files as administrator. – BigRed Jul 13 '21 at 12:17
  • @BigRed, there is no specific place to add there files. I recommend that you create a new winform app to make the screen-capture app. In order to make your app run, I suggest that you installed x64 and x86 sdk and nuget-package both. – Jack J Jun Jul 14 '21 at 03:22