_HID_VB_1
所属分类:USB编程
开发工具:Visual Basic
文件大小:169KB
下载次数:41
上传日期:2009-09-29 16:22:48
上 传 者:
ssdao
说明: USB HID 4 bytes in 4 bytes out
文件列表:
_HID_VB_1\AssemblyInfo.vb (939, 2009-09-28)
_HID_VB_1\bin\GenericHid.exe (81920, 2009-09-28)
_HID_VB_1\bin\GenericHid.vshost.exe (5632, 2005-09-23)
_HID_VB_1\bin\GenericHid.xml (25515, 2009-09-28)
_HID_VB_1\DebugApiDeclarations.vb (717, 2008-06-20)
_HID_VB_1\Debugging.vb (1500, 2008-06-20)
_HID_VB_1\DebuggingDeclarations.vb (657, 2008-06-20)
_HID_VB_1\DeviceManagement.vb (18935, 2008-06-20)
_HID_VB_1\DeviceManagementDeclarations.vb (5052, 2008-06-20)
_HID_VB_1\FileIODeclarations.vb (3085, 2009-09-28)
_HID_VB_1\FrmMain.resx (6396, 2009-09-28)
_HID_VB_1\FrmMain.vb (68260, 2009-09-28)
_HID_VB_1\GenericHid.sln (908, 2008-06-22)
_HID_VB_1\GenericHid.suo (44032, 2009-09-28)
_HID_VB_1\GenericHid.vb (380, 2008-06-16)
_HID_VB_1\GenericHid.vbproj (7205, 2009-09-27)
_HID_VB_1\GenericHid.vbproj.user (2525, 2005-08-29)
_HID_VB_1\Hid.vb (34709, 2009-08-29)
_HID_VB_1\HidDeclarations.vb (5955, 2008-06-20)
_HID_VB_1\My Project\Application.Designer.vb (438, 2009-09-28)
_HID_VB_1\My Project\Application.myapp (476, 2005-08-29)
_HID_VB_1\My Project\Resources.Designer.vb (2776, 2009-09-28)
_HID_VB_1\My Project\Resources.resx (5228, 2005-08-26)
_HID_VB_1\My Project\Settings.Designer.vb (2860, 2009-09-28)
_HID_VB_1\My Project\Settings.settings (233, 2005-08-26)
_HID_VB_1\ndpsetup.ico (25214, 2009-09-27)
_HID_VB_1\obj\Debug\GenericHid.exe (94208, 2009-09-28)
_HID_VB_1\obj\Debug\GenericHid.FrmMain.resources (180, 2009-09-28)
_HID_VB_1\obj\Debug\GenericHid.pdb (138752, 2009-09-28)
_HID_VB_1\obj\Debug\GenericHid.Resources.resources (180, 2008-06-16)
_HID_VB_1\obj\Debug\GenericHid.vbproj.GenerateResource.Cache (844, 2009-09-28)
_HID_VB_1\obj\Debug\GenericHid.xml (25515, 2009-09-28)
_HID_VB_1\obj\Debug\TempPE\My Project.Resources.Designer.vb.dll (7680, 2009-09-28)
_HID_VB_1\obj\GenericHid.vbproj.FileList.txt (534, 2009-09-28)
_HID_VB_1\obj\GenericHid.vbproj.FileListAbsolute.txt (2658, 2008-06-23)
_HID_VB_1\obj\Release\GenericHid.exe (81920, 2009-09-28)
_HID_VB_1\obj\Release\GenericHid.FrmMain.resources (180, 2009-09-28)
_HID_VB_1\obj\Release\GenericHid.Resources.resources (180, 2008-06-23)
_HID_VB_1\obj\Release\GenericHid.vbproj.GenerateResource.Cache (844, 2009-09-28)
_HID_VB_1\obj\Release\GenericHid.xml (25515, 2009-09-28)
... ...
Project: GenericHid
***********************************************************************
Software License Agreement
Licensor grants any person obtaining a copy of this software ("You")
a worldwide, royalty-free, non-exclusive license, for the duration of
the copyright, free of charge, to store and execute the Software in a
computer system and to incorporate the Software or any portion of it
in computer programs You write.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
***********************************************************************
Author Date Version
Jan Axelson 6/16/08 2.4
This software was written using Visual Basic 2005 Professional Edition. It requires
the .NET Framework V2.0 or later.
Purpose:
Demonstrates USB communications with a generic HID-class device
Requirements:
Windows *** or later and an attached USB generic Human Interface Device (HID).
Description:
Finds an attached device that matches the vendor and product IDs in the form's
text boxes.
Retrieves the device's capabilities.
Sends and requests HID reports.
Uses RegisterDeviceNotification() and WM_DEVICE_CHANGE messages
to detect when a device is attached or removed.
RegisterDeviceNotification doesn't work under Windows *** (not sure why).
A list box displays the data sent and received,
along with error and status messages.
Combo boxes select data to send, and 1-time or timed, periodic transfers.
You can change the size of the host's Input report buffer and request to use control
transfers only to exchange Input and Output reports.
To view additional debugging messages, in the Visual Studio development environment,
select the Debug build (Build > Configuration Manager > Active Solution Configuration)
and view the Output window (View > Other Windows > Output)
The application uses a Delegate and the BeginInvoke and EndInvoke methods to read
Input reports asynchronously, so the application's main thread doesn't have to
wait for the device to return an Input report when the HID driver's buffer is empty.
If you want to only receive data or only send data, comment out the unwanted code
(In ExchangeInputAndOutputReports or ExchangeFeatureReports, comment out
the "Success = " line and the "If Success" block that follows it).
This project includes the following modules:
GenericHid.vb - runs the application.
FrmMain.vb - routines specific to the form.
Hid.vb - routines specific to HID communications.
DeviceManagement.vb - routines for obtaining a handle to a device from its GUID
and receiving device notifications. This routines are not specific to HIDs.
Debugging.vb - contains a routine for displaying API error messages.
HidDeclarations.vb - Declarations for API functions used by Hid.vb.
FileIODeclarations.vb - Declarations for file-related API functions.
DeviceManagementDeclarations.vb - Declarations for API functions used by DeviceManagement.vb.
DebuggingDeclarations.vb - Declarations for API functions used by Debugging.vb.
Companion device firmware for several device CPUs is available from www.Lvr.com/hidpage.htm.
You can use any generic HID (not a system mouse or keyboard) that sends and receives reports.
New in V2.4:
To eliminate VB6 "upgrade support" code, added GenericHid.vb file.
Uses XML comments.
Uses SafeFileHandle and SafeWaitHandle instead of IntPtr in "file" and wait operations.
The Namespace, Assembly, and Root Namespace are all titled "GenericHid".
The Solution is titled "GenericHid_vb".
Other minor refinements.
New in version 2.3:
In the asychronous ReadFiles, the GetInputReportData callback routine uses marshaling to
perform actions on the form, which runs in a different thread.
The marshaling is required by the .NET Framework 2.0.
I also fixed a few other things that the compiler complained about.
New in version 2.2:
The application obtains separate handles for device information/Feature reports,
Input reports, and Output reports. This enables getting information about
mice and keyboards.
The application detects if the device is a mouse or keyboard
and warns that Windows 2000/XP will not allow exchanging Input or Output reports.
The list box's contents are trimmed when they get too large.
For more information about HIDs and USB, and additional example device firmware to use
with this application, visit Lakeview Research at http://www.Lvr.com .
Send comments, bug reports, etc. to jan@Lvr.com .
This application has been tested under Windows XP and Windows Vista.
近期下载者:
相关文件:
收藏者: