Screen2Video Pro SDK ActiveX

Screen2Video Pro SDK ActiveX

Platform : Windows 10, Windows 8, Vista, Windows 7, XP

For Windows Developers who need to Screen Recording with Speaker or Microphone to H264 MP4, AVI, WMV, SWF, FLV for C++, c#, vb.net , vb, delphi, vfp, MS Access.

Popular Solution Go   Back

WPF - Screen Capturing in WPF.

Step 1: To install the Screen2Pro SDK ActiveX Control, begin by launching the setup file (http://www.viscomsoft.com/demo/screen2videoprosetup.exe). Select the desired installation folder for the Screen2Pro SDK ActiveX and continue with the installation on your development computer.

Step 2: Create New Visual C# Project, select Windows Application. 
 

Step 3: Select File - Add New Project ... Add a Windows Forms Control Library project to the application project, and name the project Screen2VideoAxLib.
 
Step 4: In Screen2VideoAxLib, select UserControl1 and open it
.



Step 5: In Toolbox, Right Click Mouse and select Choose Item... , select COM Components Tab, select Screen2Video Pro Control, click OK button to confirm.



 Step 6: From the Toolbox, add the Screen2Video Pro control to the design surface.

 

Press F7 to Build Solution.

Step 7: In the WpfApplication1 project, add a reference to the generated Screen2Video Pro ActiveX interoperability assembly.
This assembly is named AxInterop.SCREEN2VIDEOLib.dll and was added to the Debug folder of the Screen2VideoAxLib project when you imported the Screen2Video Pro control. 



 
 
Step 8: In the WpfApplication1 project, select add a reference, then select Projects tab, select Screen2VideoAxLib project.
 
 
 Step 9: Add a reference to the WindowsFormsIntegration assembly, which is named WindowsFormsIntegration.dll.

 
 Step 10: Add a reference to the Windows Forms assembly, which is named System.Windows.Forms.dll.



Step 11: In the WpfApplication1 project, select add a reference, then select COM tab, select Screen2Video Pro ActiveX Control

Step 12: Replace the code in MainWindow.xaml with the following code.

 
   
Step 13: add two button in MainWindow.xaml with the following code.
       
 
Step 14: Insert the following code to handle the Start button's click event.

 private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            axScreen2Video1.CaptureWidth = axScreen2Video1.ScreenWidth();
            axScreen2Video1.CaptureHeight = axScreen2Video1.ScreenHeight();
            axScreen2Video1.OutputType = SCREEN2VIDEOLib.MYOUTPUT.MP4;
            axScreen2Video1.MP4AudioBitrate =224000;
            axScreen2Video1.MP4AudioChannels = 2;
            axScreen2Video1.MP4AudioSampleRate = 44100;
            axScreen2Video1.MP4Framerate = 25;
            axScreen2Video1.MP4Height =720;
            axScreen2Video1.MP4Width = 1280;
            axScreen2Video1.MP4VideoBitrate = 4600000;
            axScreen2Video1.FPS =25;
            axScreen2Video1.AudioDevice =0;
            axScreen2Video1.AudioInputPin = 0;
            axScreen2Video1.CaptureArea(0,0,axScreen2Video1.CaptureWidth,axScreen2Video1.CaptureHeight);
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.DefaultExt = ".mp4";
            dlg.Filter = "MP4 file(.mp4)|*.mp4";
            Nullable result = dlg.ShowDialog();
            if (result == true)
            {
                string filename = dlg.FileName;
                axScreen2Video1.FileName = filename;
            }
            else
                return;
            axScreen2Video1.Start();
            btnStart.IsEnabled = false;
            btnStop.IsEnabled = true;
        }
 
Step 15: Insert the following code to handle the Stop button's click event. 

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            axScreen2Video1.Stop();
            btnStart.IsEnabled = true;
            btnStop.IsEnabled = false;
        }
 
Step 16: Press F5 to build and run the application.

Step 17: Download the sample source code from Screen-Capturing-WpfApplication1.zip