Screen record by C++ with Screen Capturing SDK – use the sample source code below. You may also use it from C# and other languages to record screen video.

C++

// CaptureFromEntireScreen.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#import "BytescoutScreenCapturing.dll"

using namespace BytescoutScreenCapturingLib;
using namespace std;


void usage(ICapturer* capturer);
void setParams(int argc, _TCHAR* argv[], ICapturer* capturer);


int _tmain(int argc, _TCHAR* argv[])
{
::CoInitialize(0);

// Create Capturer instance

CLSID clsid_ScreenCapturer;
CLSIDFromProgID(OLESTR("BytescoutScreenCapturing.Capturer"), &clsid_ScreenCapturer);

ICapturer* capturer = NULL;
::CoCreateInstance(clsid_ScreenCapturer, NULL, CLSCTX_ALL, __uuidof(ICapturer), (LPVOID*)&capturer);

if (!capturer)
{
 _ftprintf(stdout, _T("Screen Capturer is not installed properly."));
 ::CoUninitialize();
 return 1;
}

capturer->put_RegistrationName(_T("demo"));
capturer->put_RegistrationKey(_T("demo"));

// Set capturing type
capturer->put_CapturingType(catScreen);

// Set output video width and height
capturer->put_OutputWidth(640);
capturer->put_OutputHeight(480);

// Set output file name
capturer->OutputFileName = _T("Output.wmv");

// Start capturing
HRESULT hr = capturer->Run();

if (FAILED(hr))
{
 // Error handling
 CComBSTR s;
 capturer->get_LastError(&s);
 _ftprintf(stdout, _T("Capture failed: %sn"), CString(s));
}
else
{
 _tprintf(_T("Starting capture - Hit a key to stop ...n"));

 int i = 0;
 TCHAR *spin = _T("|/-\");

 // Show some progress
 while (!_kbhit())
 {
 	_tprintf(_T("rEncoding %c"), spin[i++]);
 	i %= 4;
 	Sleep(50);
 }

 // Stop after key press
 capturer->Stop();
 
 _tprintf(_T("nDone."));
 getchar();
}

// Release Capturer
capturer->Release();
capturer = NULL;

::CoUninitialize();

return 0;
}