Source code examples

Below we show sample code of applications running view-agent for several systems and programming languages.

windows

C++

Copy

{

std::wstring channel_id = L""; // Your application ID (copy it from channel block)

std::wstring app_version = L""; // Your application's current release version

std::wstring mode = L"NORMAL"; // Leave it this way


const size_t size =1024;

wchar_t commandLine[size];


std::memset(commandLine,  L'\0',  size * sizeof(wchar_t));


swprintf(commandLine,  size,  L"AppVersion.exe %s %s %s",   channel_id.data(),  app_version.data(),  mode.data());


STARTUPINFO sartupInfo;

PROCESS_INFORMATION processInformation;


// AppVersion.info window will be shown if the below conditions are met:

// - channel with id = channel_id exists,

// - banner with id = app_version exists in this channel,

// - this is not the first run of AppVersionInfo.exe,

// - previous run was with a diffrent app_version number.

// So basically, for the first time, you shouldn't expect anything to happen, and it's o.k.

// If you want to see something:

// - run your code with_appversion = "1",

// - prepare banner for release version = 2,

// - run your code with_appversion = "2".


CreateProcess(NULL,  commandLine,  NULL,  NULL,  TRUE,  0,  NULL,  NULL,  &sartupInfo,  &processInformation);

}

linux

C#

Copy

{

string channel_id= ""; // Your application ID (copy it from channel block)

string app_version= ""; // Your application's current release version

string mode= ""; // Leave it this way


ProcessStartInfo appVersionProcess = new ProcessStartInfo("AppVersion.exe")

{

ArgumentList = { channel_id, app_version, mode },

WindowStyle = ProcessWindowStyle.Normal,

UseShellExecute = true

};


// AppVersion.info window will be shown if the below conditions are met:

// - channel with id = channel_id exists,

// - banner with id = app_version exists in this channel,

// - this is not the first run of AppVersionInfo.exe,

// - previous run was with a diffrent app_version number.

// So basically, for the first time, you shouldn't expect anything to happen, and it's o.k.

// If you want to see something:

// - run your code with_appversion = "1"

// - prepare banner for release version = 2,

// - run your code with_appversion = "2".


var newProcess = Process.Start(appVersionProcess);

}

Have you written code for another system/language? Why don't you share it with us? Contact us to do it.