Skip to content
GBG Documents & Biometrics Documentation

Using the SDK with Visual C++

This section describes how to use the AssureID Sentinel SDK with Visual C++.

Before you can use the SDK from an application, it must be referenced from your application’s project in Visual C++. From Microsoft Visual C++, the AssureID COM Platform SDK Library can be referenced by importing the AssureIDCOMPlatformSDK.dll type library information (included in the installation).

#import “AssureIDCOMPlatformSDK.dll”

Ensure that this file has been added to the project include paths or has been copied to the project directory.

In order to access the AssureID Sentinel SDK COM components from C++, CoInitializeEx() must be called (from the thread that will be using the SDK). For example:

HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

or to initialize COM for multithreading:

HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

From within the C++ application, the AssureIDSession object must be instantiated in Visual C++. The following code example uses COM smart pointers (_com_ptr) generated by the #import above to create the AssureIDSession instance:

using namespace AssureIDPlatformSDK;
IAssureIDSessionPtr session(__uuidof(AssureIDSession));

After the AssureIDSession object has been instantiated, the Open method must be called in Visual C++ to actually open the session and connect it to the AssureID DAP service. The following example illustrates calling the Open method:

HRESULT hr = session->Open();

Note: The Open method will succeed even if the DAP service is not currently running. The DAP service is installed to start automatically, however it can be started and stopped manually from the Windows Control Panel in Administrative Tools > Services. When the DAP service is started, any open sessions automatically connect to it.

To determine if a session is currently connected, check the IsConnected property.

After successfully connecting, you can call methods in Visual C++ to control the DAP. These methods allow the document trigger mode and transaction mode to be setup for the DAP and allow manual triggering of documents and transactions.

To receive events from within Visual C++, _IAssureIDSessionEvents, you must implement a COM event-handling interface. For more information on implementing the event handler and synchronizing it to the AssureIDSession, see the Microsoft Visual C++ documentation on Connection Points and the IDispEventImpl and IDispEventSimpleImpl ATL classes.

You can access information about the current document or transaction with C++ in two ways. Event arguments contain references to relevant data (such as the transaction, the document, and the document image). The current transaction and document are also accessible from the AssureIDSession object directly by using the CurrentDocument and CurrentTransaction properties.