embedded24.net - USB HID Host driver for Windows

USB HID devices are widely used in control and electronics in general. There are many microcontrollers from many manufacturers with built-in USB support. The needful firmware for the devices is provided by the manufacturers. But on the Host side, it is still hard to develop a driver. Stop racking your brain and start using AHID Dynamic Link Library - a simple way to interface USB HID devices!


- AHid_Init(): Driver initialization.
- AHid_Register(): Interface registration.
- AHid_Deregister(): Remove from registration.
- AHid_Write(): Write data.
- AHid_Read(): Read data.
- AHid_Request(): Request a Feature Report.
- AHid_Attached(): Device connected or removed?
- AHid_Find(): Find the device.
- AHid_Identify(): Distinguish between several HID devices of the same type.
- AHid_Info(): Show an info box.


Initialize the AHID Dynamic Link Library by a call to AHid_Init(). The next step is to create an interface with AHid_Register(). The function returns a handle to your USB device.
AHid_Write() sends data to your device. It's done using Interrupt or Control (Feature Reports) transfers, depending on the setting used in AHid_Register().

AHid Host Driver Application

Figure: Transfer between USB-Device and Host-Application

Using Interrupt Transfers, data reception is done automatically. The AHID.DLL creates an additional thread to listen for incoming data. After data detection, the AHID.DLL sends a RECEIVED message to your Window Message Loop where you collect the data by a call to AHid_Read().
Feature Reports are requested by a call to AHid_Request(). And again, the AHID.DLL sends a RECEIVED message to your application after data reception. Call AHid_Read() to collect the data. This approach delegates all incoming data to the same place, so the implementation of a State Machine is very easy.

The AHid_Attached() function is called after removing or attaching your device from USB. The return value indicates its new state (connected/disconnected). AHid_Find() is quite similar. It searches active for your device and returns true when it is detected.
AHid_Info() has no function in normal operation. It simply displays a message box with some information about the AHID Dynamic Link Library.


- HID USB Host Driver DLL for Windows
- Can be used with Composite Devices
- Support of identical USB Devices on different USB Ports
- Including automatic Device Detection
- Multithreaded Approach for non blocking Data Transfer
- Based on Windows Messaging System
- To use with Input, Output and Feature Reports
- Allows different Report Id's
- Recommended for low and high Throughput

AHID Driver Info

This little helper reads parameters from your HID device and tells you how to register with the AHID.DLL. All you need is the VID and PID of your USB device.

Version 08/2015

Download the free version of AHID.DLL and many demo applications from www.ahidlib.com:

- AHID Demo C++ (WIN32 API, VS 2010 Express)
- AHID Demo C++/CLI (VS 2010 Express)
- AHID Demo C# (VS 2010 Express)
- AHID Demo VB (VS 2010 Express)
- AHID Demo LabVIEW (LabVIEW 2012)
- AHID Demo Scilab (Scilab 5.4.1)
- AHID Demo Matlab


If you find any errors or omissions, or if you have suggestions, please let us know: