资源简介
是用C#写的读取USB HID设备的测试软件,输入VID、PIV,查找HID设备是否存在,如果存在,则读取指定的HID设备发来的数据。软件已测试,可以直接使用。(不可读取键盘、鼠标),只能读取自定义HID设备,同时可以自定义读取数据时的超时时间
代码片段和文件信息
using Microsoft.Win32.SafeHandles;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
///
/// 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
/// Jan Axelson
///
/// This software was written using Visual Studio 2008 Standard Edition and building
/// for the .NET framework 2.0.
///
/// Purpose:
/// Demonstrates USB communications with a generic HID-class device
///
/// Requirements:
/// Windows 98 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 98 (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 an asynchronous FileStream 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.
///
/// For code that finds a device and opens handles to it see the FindTheHid routine in frmMain.cs.
/// For code that reads from the device search for fileStre
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3570 2015-07-01 14:17 generic_hid_cs\GenericHid.sln
..A..H. 51712 2015-05-04 18:32 generic_hid_cs\GenericHid.suo
..A..H. 99328 2015-07-01 17:21 generic_hid_cs\GenericHid.v11.suo
文件 30208 2015-06-30 18:23 generic_hid_cs\GenHipApp\bin\Debug\GenericHid.dll
文件 60928 2015-06-30 18:23 generic_hid_cs\GenHipApp\bin\Debug\GenericHid.pdb
文件 23552 2015-07-01 14:15 generic_hid_cs\GenHipApp\bin\Debug\GenHipApp.exe
文件 40448 2015-07-01 14:15 generic_hid_cs\GenHipApp\bin\Debug\GenHipApp.pdb
文件 21472 2015-07-01 14:15 generic_hid_cs\GenHipApp\bin\Debug\GenHipApp.vshost.exe
文件 490 2010-03-17 22:39 generic_hid_cs\GenHipApp\bin\Debug\GenHipApp.vshost.exe.manifest
文件 53162 2015-07-01 14:34 generic_hid_cs\GenHipApp\FrmMain.cs
文件 6183 2015-07-01 14:06 generic_hid_cs\GenHipApp\FrmMain.resX
文件 3811 2014-01-16 09:12 generic_hid_cs\GenHipApp\GenHipApp.csproj
文件 1229 2015-07-01 11:46 generic_hid_cs\GenHipApp\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6942 2015-05-05 18:05 generic_hid_cs\GenHipApp\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 180 2015-06-30 18:23 generic_hid_cs\GenHipApp\obj\x86\Debug\GenericHid.Properties.Resources.resources
文件 845 2015-07-01 14:15 generic_hid_cs\GenHipApp\obj\x86\Debug\GenHipApp.csproj.FileListAbsolute.txt
文件 849 2015-07-01 14:06 generic_hid_cs\GenHipApp\obj\x86\Debug\GenHipApp.csproj.GenerateResource.Cache
文件 7480 2015-06-30 18:23 generic_hid_cs\GenHipApp\obj\x86\Debug\GenHipApp.csprojResolveAssemblyReference.cache
文件 23552 2015-07-01 14:15 generic_hid_cs\GenHipApp\obj\x86\Debug\GenHipApp.exe
文件 40448 2015-07-01 14:15 generic_hid_cs\GenHipApp\obj\x86\Debug\GenHipApp.pdb
文件 180 2015-07-01 14:06 generic_hid_cs\GenHipApp\obj\x86\Debug\Synoxo.Wangjunhua.FrmMain.resources
文件 4608 2015-07-01 14:34 generic_hid_cs\GenHipApp\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 502 2015-07-01 14:34 generic_hid_cs\GenHipApp\Program.cs
文件 1374 2013-07-10 20:17 generic_hid_cs\GenHipApp\Properties\AssemblyInfo.cs
文件 2867 2015-07-01 14:34 generic_hid_cs\GenHipApp\Properties\Resources.Designer.cs
文件 5612 2013-07-10 20:17 generic_hid_cs\GenHipApp\Properties\Resources.resx
文件 1113 2015-07-01 14:34 generic_hid_cs\GenHipApp\Properties\Settings.Designer.cs
文件 249 2013-07-10 20:17 generic_hid_cs\GenHipApp\Properties\Settings.settings
文件 1133 2014-02-15 11:34 generic_hid_cs\USBHiDLib\AssemblyInfo.cs
文件 30208 2015-07-01 14:34 generic_hid_cs\USBHiDLib\bin\Debug\GenericHid.dll
............此处省略92个文件信息
相关资源
- C# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论