Read Barcode From Image - C++ (Managed)
BarCode Reader SDK sample in C++ (Managed) demonstrating ‘Read Barcode From Image’
AssemblyInfo.cpp
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("HelloWorld")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("HelloWorld")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2010")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
CommonExample.cpp
#include "stdafx.h"
using namespace System;
using namespace System::IO;
using namespace System::Drawing;
using namespace Bytescout::BarCodeReader;
int main(array<System::String ^> ^args)
{
String ^path = "BarcodePhoto.jpg";
Console::WriteLine("Reading barcode(s) from image " + Path::GetFullPath(path));
Reader ^bc = gcnew Reader();
// Set to find all barcode types
bc->BarcodeTypesToFind->All = true;
// But we recommend to use specific barcode types to avoid false positives, e.g.:
// bc->BarcodeTypesToFind->QRCOde = true;
// bc->BarcodeTypesToFind->Code39 = true;
// Decode barcodes
bc->ReadFrom(path);
for (int i=0; i < bc->FoundCount; i++)
{
Console::WriteLine("Found barcode with type: " + bc->GetFoundBarcodeType(i).ToString() + " and value: " + bc->GetFoundBarcodeValue(i));
}
Console::WriteLine("Press any key to exit..");
Console::ReadKey();
return 0;
}
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc
stdafx.cpp
// stdafx.cpp : source file that includes just the standard includes
// HelloWorld.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
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
// TODO: reference additional headers your program requires here