资源简介
USBHID通信
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace USBHIDControl
{
public partial class Form1 : Form
{
USBHID usbHID = null;
public Form1()
{
InitializeComponent();
usbHID = new USBHID();
foreach (string device in usbHID.GetDeviceList())
list_UsbHID.Items.Add(device);
usbHID.DataReceived += usbHID_DataReceived;
usbHID.DeviceRemoved += usbHID_DeviceRemoved;
}
void usbHID_DeviceRemoved(object sender EventArgs e)
{
report myRP = (report)e;
if (InvokeRequired)
{
Invoke(new EventHandler(usbHID_DeviceRemoved) new object[] { sender e });
}
else
{
tb_information.Text = “设备连接“;
}
}
void usbHID_DataReceived(object sender EventArgs e)
{
report myRP = (report)e;
if (InvokeRequired)
{
Invoke(new EventHandler(usbHID_DataReceived) new object[] { sender e });
}
else
{
tb_information.Text += “\r\n“ +USBHID.ByteToHexString(myRP.reportBuff);
}
}
///
/// open USB HID
///
///
///
private void btn_connect_Click(object sender EventArgs e)
{
if (list_UsbHID.SelectedItem == null) {
tb_information.Text += “\r\n vendorID和productID不能为空“;
return;
}
if (usbHID.OpenUSBHid(list_UsbHID.SelectedItem.ToString()))
tb_information.Text += “\r\n open success“;
else
tb_information.Text += “\r\n open fail“;
}
private void btn_send_Click(object sender EventArgs e)
{
tb_information.Text +=“\r\n w: “+ usbHID.WriteUSBHID(tb_send.Text);
}
private void btn_clear_Click(object sender EventArgs e)
{
tb_information.Text = ““;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
.CA..H. 39936 2018-01-03 05:06 USBHIDControl\.vs\USBHIDControl\v15\.suo
.CA.... 0 2018-01-03 04:56 USBHIDControl\.vs\USBHIDControl\v15\Server\sqlite3\db.lock
.CA.... 577536 2018-01-03 05:06 USBHIDControl\.vs\USBHIDControl\v15\Server\sqlite3\storage.ide
.CA.... 18432 2018-01-03 04:56 USBHIDControl\bin\Debug\USBHIDControl.exe
.CA.... 36352 2018-01-03 04:56 USBHIDControl\bin\Debug\USBHIDControl.pdb
.CA.... 11600 2014-11-13 23:41 USBHIDControl\bin\Debug\USBHIDControl.vshost.exe
.CA.... 490 2010-03-17 22:39 USBHIDControl\bin\Debug\USBHIDControl.vshost.exe.manifest
.CA.... 2391 2014-11-13 23:04 USBHIDControl\Form1.cs
.CA.... 6794 2014-11-13 23:04 USBHIDControl\Form1.Designer.cs
.CA.... 5817 2014-11-13 23:04 USBHIDControl\Form1.resx
.CA.... 2494 2018-01-03 04:57 USBHIDControl\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
.CA.... 7113 2018-01-03 04:57 USBHIDControl\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
.CA.... 220 2014-11-13 23:04 USBHIDControl\obj\x86\Debug\GenerateResource.read.1.tlog
.CA.... 562 2014-11-13 23:04 USBHIDControl\obj\x86\Debug\GenerateResource.write.1.tlog
.CA.... 42 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.csproj.CoreCompileInputs.cache
.CA.... 2011 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.csproj.FileListAbsolute.txt
.CA.... 939 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.csproj.GenerateResource.Cache
.CA.... 18432 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.exe
.CA.... 180 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.Form1.resources
.CA.... 36352 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.pdb
.CA.... 180 2018-01-03 04:56 USBHIDControl\obj\x86\Debug\USBHIDControl.Properties.Resources.resources
.CA.... 494 2014-11-13 23:04 USBHIDControl\Program.cs
.CA.... 1358 2014-11-13 23:04 USBHIDControl\Properties\AssemblyInfo.cs
.CA.... 2877 2014-11-13 23:04 USBHIDControl\Properties\Resources.Designer.cs
.CA.... 5612 2014-11-13 23:04 USBHIDControl\Properties\Resources.resx
.CA.... 1099 2014-11-13 23:04 USBHIDControl\Properties\Settings.Designer.cs
.CA.... 249 2014-11-13 23:04 USBHIDControl\Properties\Settings.settings
.CA.... 8627 2014-11-13 23:04 USBHIDControl\USBHID.cs
.CA.... 3804 2014-11-13 23:04 USBHIDControl\USBHIDControl.csproj
.CA.... 867 2014-11-14 00:08 USBHIDControl\USBHIDControl.sln
............此处省略19个文件信息
- 上一篇:C#实现调色板
- 下一篇:WPF开发串口调试助手
相关资源
- USB 继电器控制器 LCUS-1 保证能用 c#
- 神思ss628型USB二代身份证DEMOC#
- C#不用HID采用键盘钩子区分键盘输入和
- C# 斑马打印机USB接口ZPL条码打印
- C#调用USB接口斑马打印机
- WPF进度条演示程序
- 网络安全LSB算法 采用C# 实现文字的隐
- USB complete 5th edition PDF
- 上位机_USB_FPGA程序
- cyUsb C#USB通信 DLL
- LSB算法隐写术
- 通过PJL协议,获取惠普USB打印机状态
- STM32读取SBUS接收机
- c#+BaslerSDKUSB3.0和以太网口通用
- c#操作摄像头(带着usb摄像头、mjpeg
- c#实现USB摄像头录像抓拍功能
- 03 STM32F205 多功能LCD时钟-c源码 keil5
- C#学生成绩管理系统(三层架构、CS
- C#调用USB口摄像头单头,多头源码
- C#编写的USB通信含源码
- USB检测,移除|UsbEject
- 调用cyUSB.dllC#源码
- 基于WPF的USB设备浏览器
- C#把ZPL指令直接发送USB打印机
- vb.net 获取USB 摄像头 图像 Aforge方法
- C#获取usb设备VID和PID
- WPF好看的圆形ProgressBar实现
- C# USB数据接收与发送
- c# 访问USB摄像头 拍照 录像
- c#打开pos钱箱usb,lpt端口
评论
共有 条评论