How to Use Winsoft HID 1.7 D5-D10.2 Tokyo for Human Interface Devices
Human Interface Devices (HID) are devices that are operated by humans, such as keyboards, mice, game controllers, and so on. HID is a standard that allows these devices to be easily used without any extra software or drivers. HID devices can communicate with applications and operating systems through data packets that contain all the actions of the device.
Winsoft HID 1.7 D5-D10.2 Tokyo is a library for Delphi and C++ Builder that allows you to communicate with HID devices in Windows. With Winsoft HID 1.7 D5-D10.2 Tokyo, you can access the device information, read and write input, output, and feature reports, and handle device events.
In this article, we will show you how to use Winsoft HID 1.7 D5-D10.2 Tokyo to create a simple application that can read the state of a mouse button. You will need Delphi or C++ Builder 5-10.2 Tokyo installed on your computer, as well as Winsoft HID 1.7 D5-D10.2 Tokyo downloaded from https://byltly.com.
Step 1: Create a New Project
Open Delphi or C++ Builder and create a new VCL Forms Application project. Save the project as MouseHID.dpr (or MouseHID.cpp for C++ Builder).
Step 2: Add Winsoft HID Components
Go to the Component menu and choose Install Packages. Click Add and browse to the folder where you extracted Winsoft HID 1.7 D5-D10.2 Tokyo. Select the package file that matches your IDE version (for example, WHID_D102Tokyo.bpl for Delphi 10.2 Tokyo) and click Open. Click OK to install the package.
Now you should see two new components in the Winsoft category of the Tool Palette: THIDDevice and THIDDevices.
Step 3: Add a THIDDevices Component
Drag a THIDDevices component from the Tool Palette to the form. This component will enumerate all the HID devices connected to your computer and allow you to access them by index or by device path.
Step 4: Add a THIDDevice Component
Drag a THIDDevice component from the Tool Palette to the form. This component will represent a single HID device and allow you to communicate with it.
Step 5: Connect the THIDDevice Component to a Mouse Device
Select the THIDDevice component on the form and go to the Object Inspector. Set the Devices property to HIDDevices1 (the name of the THIDDevices component). Set the DeviceIndex property to -1 (this means that no device is selected yet).
Double-click on the OnCreate event of the form and add this code:
procedure TForm1.FormCreate(Sender: TObject);
// loop through all HID devices
for i := 0 to HIDDevices1.Count - 1 do
// check if the device is a mouse
if HIDDevices1[i].UsagePage = $01 then // generic desktop controls
if HIDDevices1[i].Usage = $02 then // mouse
// select the mouse device
HIDDevice1.DeviceIndex := i;
This code will loop through all the HID devices enumerated by HIDDevices1 and find the first one that has a usage page of $01 (generic desktop controls) and a usage of $02 (mouse). It will then assign its index to HIDDevice1.DeviceIndex, which will open the device for communication.
Step 6: Add a Label Component
Drag a TLabel component from the Tool Palette to the form. This component will display the state of the mouse button.