![]() |
Languages »
C# »
General
Intermediate
License: The Code Project Open License (CPOL)
A USB HID Component for C#By wimarA component to communicate with a USB HID device |
C#2.0.NET2.0, WinXPVS2005, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
This article is about a USB HID component which enables you to communicate with HID devices over USB. There is no default component available for USB at this moment, and this component should provide you with a good starting point when writing your own USB HID enabled applications.
This article provides a sample application as well as the component itself.
The component is based on various sources. A good start for USB in C# is this website. Also the book USB COMPLETE (third edition) by Jan Axelson is a must read for anyone wishing to incorporate USB HID into her/his application.
The component is developed during a project at the Avans Hogeschool in 's-Hertogenbosch, The Netherlands.
In the provided sample application, there is a good demonstration on how to include the component. Moreover, the use of the component is very well demonstrated. The only thing that must be done in your own application is implementing the events.
You'll also have to override the following functions in your form, so that your program is USB aware. In the property box, you'll have to provide a vendor and product id of your USB device in order to detect the correct device.
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
usb.RegisterHandle(Handle);
}
protected override void WndProc(ref Messagea m)
{
usb.ParseMessages(ref m);
base.WndProc(ref m); // pass message on to base form
}
A mouse is always in use by Windows, and cannot be captured by your own application. This also applies to HID devices in use by other applications.
Updates will be posted if there is a need for them.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 22 Mar 2007 Editor: Deeksha Shenoy |
Copyright 2007 by wimar Everything else Copyright © CodeProject, 1999-2010 Web18 | Advertise on the Code Project |