sgcBiometrics in five minutes

Windows Hello and fingerprint authentication in Delphi, through the Windows Biometric Framework. This page brings a sensor up, verifies the user in front of it, and identifies who they are. Two method calls, once the sensor is initialised.

Windows Hello face and fingerprint
Windows only, through winbio.dll
One build, no feature tiers

What the first check needs

One component, one call to bring the sensor up, and one call to ask the question. There is nothing to configure first.

Face

TsgcWinBioFacial on the SGC Biometrics palette page, declared in sgcBiometrics.pas. This is the Windows Hello face component.

Fingerprint

TsgcWinBioFingerPrint, same unit, same palette page. Same shape of API, with enrolment and template management on top.

Two more components

TsgcWinBioStorageFile and TsgcWinBioUsersINI, for private-pool storage when you keep your own database of templates rather than using the system pool.

Platform

Windows only. The library loads winbio.dll at runtime and every unit is wrapped in {$IFDEF SGC_WINBIO}, so on any other target the units compile to nothing at all.

Requirements and editions

sgcBiometrics has no feature tiers, so this table is about compilers and the operating system rather than editions.

What Value
IDE Delphi 7, and Delphi 2007 through RAD Studio 13, plus the matching C++Builder versions. SGC_WINBIO is defined for every compiler version block except Delphi 2006, which defines only its version marker, so on Delphi 2006 the product compiles to nothing.
Uses clause The demo writes sgcBiometrics_WinBio_Types, sgcBiometrics, sgcBiometrics_WinBio_Storage, sgcBiometrics_WinBio_Storage_File, sgcBiometrics_Classes, sgcBiometrics_Client, sgcBiometrics_WinBio_Client, sgcBiometrics_WinBio_Client_Facial. For a plain verify you need far fewer.
Editions There are none. The product's own sgcVer.inc is a compiler-version map and nothing else, with no SGC_EDT_* define anywhere. Every component is in every build.
Which Windows API The classic Win32 Windows Biometric Framework, loaded dynamically from winbio.dll. It is not WinRT, so there is no recent RAD Studio floor imposed by WinRT bindings.
Platform Windows only. Every WinBio unit wraps its interface and implementation in {$IFDEF SGC_WINBIO}, and every one of them has Windows in its uses clause. Without the define the units contain no types at all.
Hardware A biometric sensor Windows already recognises. If Windows Hello works in the Settings app, the component will find the same sensor.

The presence-monitoring events used by the facial component are the Windows 10 generation of the API. If Windows Hello face sign-in is available on the machine, the component has what it needs.

Install and find the palette page

Compile the runtime package before you install the design-time one, because the second references the first.

1. Unzip

Unzip the download to a folder, called {$DIR} below.

2. Library path

Tools, Options, Environment Options, Directories. Add {$DIR}\source, which applies to every RAD Studio version.

3. Add the lib folder

Add the version-specific folder as well, for example {$DIR}\libD13\$(Platform) on RAD Studio 13, down to {$DIR}\libD7 with no platform suffix on the oldest compilers.

4. C++Builder only

Also put the lib folder on the System Include path, and the dcp\$(Platform) folder, which holds the .bpi files, on the library path.

5. Build the packages

Open Packages\sgcBiometricsD13.groupproj for your IDE version. Compile sgcBiometricsD13.dpk first, then install dclsgcBiometricsD13.dpk. A page called SGC Biometrics appears with four components.

Verify a user, in about ten lines

Bring the sensor up, then ask one of two questions: is this the expected person, or who is this? Both return an answer directly.

FFacial.pas
uses
  SysUtils, Classes,
  // sgc
  sgcBiometrics, sgcBiometrics_WinBio_Client,
  sgcBiometrics_WinBio_Client_Facial;

procedure TFRMFacial.btnFacialRecognizeClick(Sender: TObject);
begin
  if not Facial.SessionIsOpen then
  begin
    if Facial.InitializeSensors(10000) then
    begin
      if Facial.FacialRecognize then
        DoLog('#Recognized');
    end;
  end
  else
  begin
    if Facial.FacialRecognize then
      DoLog('#Recognized');
  end;
end;

InitializeSensors returns a Boolean and takes a timeout in milliseconds. SessionIsOpen stops you opening a second session on a sensor that already has one. FacialRecognize returns True when the person in front of the camera matched.

FFacial.pas
procedure TFRMFacial.btnFacialIdentifyClick(Sender: TObject);
begin
  if not Facial.SessionIsOpen then
  begin
    if Facial.InitializeSensors(10000) then
      DoLog('#Identified: ' + Facial.FacialIdentify)
  end
  else
    DoLog('#Identified: ' + Facial.FacialIdentify);
end;

The difference between the two calls is the question. FacialRecognize asks "is this the expected person" and returns a Boolean. FacialIdentify asks "who is this" and returns the account identifier as a string, empty when nobody was recognised. Both take an optional timeout that defaults to ten seconds.

FFacial.pas
// Three parameters, and the third has a default.
// There is no OnCapture: the capture event is OnCaptureSample.
procedure TFRMFacial.FacialError(Sender: TObject; const aError: string;
  const aCode: Integer);
begin
  DoLog('Error: ' + aError + ' [' + IntToStr(aCode) + ']');
end;

The other events carry Windows Biometric Framework structures, so their parameter lists are longer than a typical Delphi event. OnVerify takes six parameters and OnIdentify four. Generate them from the Object Inspector rather than typing them.

All three tabs come from the shipped demo Demos\Facial\FFacial.pas, with the log calls kept because they are how you see what happened. A second demo, Demos\FingerPrint, covers enrolment, template management and the private sensor pool.

Read the answer the call gives you

Both questions return a value directly, so the first version of your code needs no event handler at all.

InitializeSensors

Returns True when a session opened on a sensor. A False here means there is nothing to talk to, and no later call will work.

FacialRecognize

Returns True when the person matched. That single boolean is the whole answer for an authentication prompt.

FacialIdentify

Returns the account identifier of whoever was recognised, and an empty string when nobody was. Use it when you need to know who rather than whether.

OnError

procedure(Sender: TObject; const aError: string; const aCode: Integer = 0). The code is the Windows Biometric Framework error, which is what you want when the message alone is not enough.

What usually goes wrong the first time

Six problems account for nearly every first attempt.

Nothing happens and no error appears

The sensor session was never opened. InitializeSensors returns a Boolean, and the demo checks it before doing anything else. SessionIsOpen tells you whether a session is already live, so you do not open a second one.

The call blocks the user interface

Verification waits for the person in front of the sensor, and the timeout defaults to ten seconds. Pass a shorter one, or set Asynchronous and drive the result from the events instead.

You are looking for an OnCapture event

There is no event with that name. The capture event is OnCaptureSample, and there is a companion OnCaptureSampleReject for a sample the sensor refused.

The event signature does not match

These events carry the Windows Biometric Framework structures, so they have more parameters than you might expect. OnVerify takes six, including the identity, the sub factor and the reject detail. Let the IDE generate the handler rather than typing it.

It will not compile on another platform

It cannot. Every WinBio unit is wrapped in {$IFDEF SGC_WINBIO}, which is defined only in the Windows compiler blocks, so off Windows the units contain no types. This is a Windows library.

The private pool needs administrator rights

Working with your own template database rather than the system pool is a privileged operation, and the fingerprint demo has a separate tab for it for that reason.

Beyond the first check

Four directions, all inside the same library.

Enrol your own users

The fingerprint component carries the full enrolment cycle: begin, capture repeatedly, then commit. The events report the swipe count and whether the template was new.

sgcBiometrics features

Keep your own template database

The storage and users components implement a private pool, so templates live in your file rather than in the Windows system pool. That is what you want when the same identity has to work across machines you control.

sgcBiometrics features

Watch for presence, not just a prompt

The facial component can monitor who is in front of the camera continuously, raising events as a person arrives, is recognised or leaves. That is how you lock a screen the moment the operator walks away.

sgcBiometrics features

Enumerate what the machine has

Before prompting anyone, you can list the biometric units, the databases and the existing enrolments, which turns an unhelpful failure into a clear message about missing hardware.

Editions and packaging

Reference, demos and documentation

Two demo projects ship inside the download, one for face and one for fingerprint.

sgcBiometrics features What the fingerprint and facial components each expose.
Editions and packaging How the product is licensed, and what each package includes.
Product overview What sgcBiometrics is for, and where it fits.
Download the trial The same installer as production, time limited.
Contact support Direct email support from the developers who wrote the code.
All products Pricing for every eSeGeCe library in one table.

sgcBiometrics is Delphi and C++Builder only, with no .NET counterpart. Every product has its own quick start, listed on the getting started page.

sgcBiometrics quick start questions

For Windows Hello face recognition, TsgcWinBioFacial. For fingerprint, TsgcWinBioFingerPrint. Both are declared in sgcBiometrics.pas and both are on the SGC Biometrics palette page, alongside TsgcWinBioStorageFile and TsgcWinBioUsersINI, which you only need for private-pool storage. So four components in total, not one.
On the facial component, FacialRecognize returns a Boolean, true when the person in front of the camera matched. FacialIdentify returns a string, the account identifier of whoever was recognised, and an empty string when nobody was. Both take an optional timeout that defaults to ten seconds, and both need a sensor session, which you open with InitializeSensors.
No. Every WinBio unit wraps its whole interface and implementation in {$IFDEF SGC_WINBIO}, that define appears only in the Windows compiler blocks of the product's own sgcVer.inc, and every unit has Windows in its uses clause. With the define absent the units contain no types at all. sgcBiometrics is a Windows library.
No, it is the classic Win32 Windows Biometric Framework. The library loads winbio.dll dynamically and calls it directly. That matters for two reasons: there is no modern RAD Studio floor imposed by WinRT bindings, and the API surface is the one documented by Microsoft as the Windows Biometric Framework rather than the WinRT one.
Delphi 7, and Delphi 2007 through RAD Studio 13, plus the matching C++Builder versions. SGC_WINBIO is defined in every compiler version block from Delphi 7 onward with one gap: the Delphi 2006 block defines only its version marker and not SGC_WINBIO, so on that one compiler the product builds to nothing.
There are no editions in the code. The product's sgcVer.inc is a compiler-version map and carries no SGC_EDT_* define at all, and nothing is gated by tier, so every build contains every component. Whatever tiers appear on the pricing page are commercial packaging, not different libraries.
More than three. The facial component publishes twelve, and the fingerprint component eighteen. They carry the Windows Biometric Framework structures, so the parameter lists are longer than a typical Delphi event: OnVerify has six parameters, OnIdentify four, and OnError three. Let the IDE generate the handlers. Note there is no OnCapture; the capture event is OnCaptureSample.
You need a biometric sensor that Windows already recognises, which in practice means Windows Hello works in the Settings app. Verifying against the system pool needs no elevation. Working with a private pool, where you keep your own template database through TsgcWinBioStorageFile, does require administrator rights, and the shipped fingerprint demo separates that into its own tab for that reason.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to add Windows Hello to your app?

Download the trial and run the facial demo on a machine that already has Hello set up.