ByteScout Data Extraction Suite - C++ - General example reading barcode with barcode reader sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Data Extraction Suite – C++ – General example reading barcode with barcode reader sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – C++ – General example reading barcode with barcode reader sdk

general example reading barcode with barcode reader sdk in C++ using ByteScout Data Extraction Suite

How to apply ByteScout Data Extraction Suite for general example reading barcode with barcode reader sdk in C++

This page helps you to learn from code samples for programming in C++. General example reading barcode with barcode reader sdk in C++ can be applied with ByteScout Data Extraction Suite. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.

This rich and prolific sample source code in C++ for ByteScout Data Extraction Suite contains various functions and options you should do calling the API to implement general example reading barcode with barcode reader sdk. If you want to know how it works, then this C++ sample code should be copied and pasted into your application’s code editor. Then just compile and run it. Updated and detailed documentation and tutorials are available along with installed ByteScout Data Extraction Suite if you’d like to learn more about the topic and the details of the API.

If you want to try other samples for C++ then free trial version of ByteScout Data Extraction Suite is available on our website.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

CommonExample.cpp
      
#include "stdafx.h" #import "c:\\Program Files\\Bytescout BarCode Reader SDK\\net2.00\\Bytescout.BarCodeReader.tlb" raw_interfaces_only using namespace Bytescout_BarCodeReader; int _tmain(int argc, _TCHAR* argv[]) { // Initialize COM. HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IReaderPtr pIReader(__uuidof(Reader)); // set the registration name and key _bstr_t registrationName(L"DEMO"); pIReader->put_RegistrationName(registrationName); _bstr_t registrationKey(L"DEMO"); pIReader->put_RegistrationKey(registrationKey); // Set barcode type to find _BarcodeTypeSelectorPtr pBarcodeTypesToFind; pIReader->get_BarcodeTypesToFind(&pBarcodeTypesToFind); pBarcodeTypesToFind->put_GS1DataBarExpanded(VARIANT_TRUE); // Get full path of sample barcode image file WCHAR file[MAX_PATH]; ::GetFullPathName(L"GS1DataBarExpanded.png", MAX_PATH, file, NULL); // Read barcode from file hr = pIReader->ReadFromFile(_bstr_t(file)); // check if file was not found if (hr == E_FAIL) { wprintf(L"File was not found: %s\n", file); } else { // Get found barcode count long count; pIReader->get_FoundCount(&count); // Get found barcode information for (int i = 0; i < count; i++) { SymbologyType type; hr = pIReader->GetFoundBarcodeType(i, &type); wprintf(L"Barcode type: %d\n", type); float confidence; hr = pIReader->GetFoundBarcodeConfidence(i, &confidence); wprintf(L"Barcode confidence: %f\n", confidence); BSTR bstrValue; hr = pIReader->GetFoundBarcodeValue(i, &bstrValue); wprintf(L"Barcode value: %s\n", bstrValue); ::SysFreeString(bstrValue); wprintf(L"\n"); } if (count == 0) { wprintf(L"No barcodes found."); } } // Uninitialize COM. CoUninitialize(); // Wait until user press any key system("pause"); return 0; }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

stdafx.cpp
      
// stdafx.cpp : source file that includes just the standard includes // BarcodeReaderExample.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

stdafx.h
      
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <stdio.h> #include <tchar.h>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next