RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD Studio

Learn About A Powerful Native HID USB Windows Library For Delphi Firemonkey By Winsoft

  1. Introduction

The Native HID library for Firemonkey is a library for communicating with Human Interface Devices. It uses Windows HID Api and supports both Windows 32 and Windows 64. A short video describes for to install the library in your Rad Studio.

2. Components in the Demo and what they do

The Demo contains only one Tbutton and TMemo component for the results in Text after onButton click execution. We first call the SetCursor procedure with chHourGlass type of Cursor. It is typically used to inform the user to wait until an application completes its current operation. Then using Enumerate all the device names are stored in a String Dynamic array. In the next short video you can see the Demo in action.

     To show all the available devices a FOR cycle goes through the DeviceNames DynArray and adds the devices line by line. Depending on the Boolean properties different report is shown in the TMemo.

  • FeatureReportSupported;
  • InputReportSupported;
  • ReadSupported

Every device in the Dynamic array is listed with Product Id, Vendor Id, version number, serial number, etc which is in other words the main info of the certain device. All this information is executed in the ShowDeviceInfo procedure.

There is also some code, executed on the FormShow event of the form.  When OnDeviceArrival event of the device is called, it executes the code bellow:

When OnDeviceRemoved event of the device is called, it executes the code bellow:

The ‘AddLine’ procedure itself checks if there is no text and lines in the TMemo. If both are true, the first line is skipped.

You can download the Demo from the link below:

https://winsoft.sk/fnathid.htm


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy. Start Free Trial   Free Delphi Community Edition   Free C++Builder Community Edition   Upgrade Today
Sign up for our daily posts newsletter!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES