ByteScout Screen Capturing SDK - C++ (unmanaged) - Capture Video From Entire Screen in QT - ByteScout

ByteScout Screen Capturing SDK – C++ (unmanaged) – Capture Video From Entire Screen in QT

  • Home
  • /
  • Articles
  • /
  • ByteScout Screen Capturing SDK – C++ (unmanaged) – Capture Video From Entire Screen in QT

How to capture video from entire screen in QT in C++ (unmanaged) using ByteScout Screen Capturing SDK

The tutorial shows how to capture video from entire screen in QT in C++ (unmanaged)

Sample source code below will show you how to cope with a difficult task like capture video from entire screen in QT in C++ (unmanaged). ByteScout Screen Capturing SDK is the SDK for developers for quick implementation of screen video recording. The SDK records screen into video or into a series of screenshots. Can also record audio. Saves video into AVI,WMV and Google’s WebM. Output video quality, size, resolution or framerate can be adjusted easily. Provides additional tools for privacy features like blacking out on scren areas with sensitive information on screen right during recording. Supports web camera as input and can add instant text and images into video output. It can capture video from entire screen in QT in C++ (unmanaged).

C++ (unmanaged) code samples for C++ (unmanaged) developers help to speed up coding of your application when using ByteScout Screen Capturing SDK. This C++ (unmanaged) sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! This basic programming language sample code for C++ (unmanaged) will do the whole work for you to capture video from entire screen in QT.

Free trial version of ByteScout Screen Capturing SDK is available for download from our website. Get it to try other source code samples for C++ (unmanaged).

Try it today: Get 60 Day Free Trial or sign up for Web API

main.cpp
      
#include "widget.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; // w.show(); Decomment if you need custom the GUI return a.exec(); }

Try it today: Get 60 Day Free Trial or sign up for Web API

widget.cpp
      
#include "widget.h" #include "ui_widget.h" #include <QDebug> #include <windows.h> #include <iostream> using namespace std; Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); //Decomment if you need to use QAxWidget //com = new QAxWidget; //Comment if you need QAxWidget com = new QAxObject; com->setControl("BytescoutScreenCapturing.Capturer"); QString error = com->property("LastError").toString(); if (error.compare("No errors.")!=0) // or empty string { cout <<"Screen Capturer is not installed properly. " << error.toStdString() << endl; exit(1); } com->setProperty("RegistrationName","demo"); com->setProperty("RegistrationKey","demo"); com->setProperty("CapturingType",3);//catScreen: Capture all screen /************************************************************************************ * The code you sent me used the webcam too. * Decomment if you need show webcam streaming ************************************************************************************* *************************************************************************************/ //com->setProperty("CurrentWebCam",0); //com->setProperty("CaptureTransparentControls",true); // Set rectangle to show overlaying video from webcam into the rectangle 160x120 (starting with left point at 10, 10) //com->dynamicCall("SetWebCamVideoRectangle(int,int,int,int)",10, 10, 160, 120); // Enable webcam overlaying capture device //com->setProperty("AddWebCamVideo",true); //com->setProperty("OutputWidth",640); //com->setProperty("OutputHeight",480); /************************************************************************************** //End webcam property /*************************************************************************************** */ // Set output file name com->setProperty("OutputFileName", "Output.wmv"); com->dynamicCall("Run()"); //' IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are //' using Thread.Sleep(1) inside the checking loop, so you have the loop like //' Do //' Thread.Sleep(1) //' While StopButtonNotClicked error = com->property("LastError").toString(); if (error.compare("No errors.")!=0) { cout <<"Capture failed. " << error.toStdString() << endl; exit(1); } //Testing purposes: //Register for 10 seconds and after stop the process //You can stop the registration as you prefer: Input, keyboard and so on.. Sleep(10000); //Usefull for testing purposes: Register for 10 seconds com->dynamicCall("Stop()"); //End registration qDebug()<<"End Registration"; } Widget::~Widget() { delete ui; }

Try it today: Get 60 Day Free Trial or sign up for Web API

widget.h
      
#ifndef WIDGET_H #define WIDGET_H #include <QWidget> #include <QKeyEvent> #include <QAxWidget> #include <QAxObject> #include <QEvent> namespace Ui { class Widget; } class Widget : public QWidget { Q_OBJECT public: explicit Widget(QWidget *parent = 0); ~Widget(); private: Ui::Widget *ui; //You can switch to QAxWidget //QAxWidget * com; QAxObject * com; }; #endif // WIDGET_H

Try it today: Get 60 Day Free Trial or sign up for Web API

MORE INFORMATION

Get 60 Day Free Trial or Visit ByteScout Screen Capturing SDK page

Explore ByteScout Screen Capturing SDK documentation

WEB API VERSION

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next