USB比較難抓數(shù)據(jù),建議是USB模擬串口,或者直接就是串口,這樣數(shù)據(jù)比較好抓。
沙依巴克ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
USB上傳模式是鼠標(biāo)光標(biāo)在哪數(shù)據(jù)就上傳在哪,所以你抓USB的數(shù)據(jù)的很難!
X貓-思刊辦公專營店
用directshow獲取幀緩存,轉(zhuǎn)換為標(biāo)準(zhǔn)圖像格式(比如jpg,png這些),存儲(chǔ)到數(shù)據(jù)庫的image字段里就行了.
以下內(nèi)容為網(wǎng)絡(luò)提供,但我自己驗(yàn)證可行,供你參考.
Imports System.IO
Public Class Form1
Public Const WM_DEVICECHANGE = H219
Public Const DBT_DEVICEARRIVAL = H8000
Public Const DBT_CONFIGCHANGECANCELED = H19
Public Const DBT_CONFIGCHANGED = H18
Public Const DBT_CUSTOMEVENT = H8006
Public Const DBT_DEVICEQUERYREMOVE = H8001
Public Const DBT_DEVICEQUERYREMOVEFAILED = H8002
Public Const DBT_DEVICEREMOVECOMPLETE = H8004
Public Const DBT_DEVICEREMOVEPENDING = H8003
Public Const DBT_DEVICETYPESPECIFIC = H8005
Public Const DBT_DEVNODES_CHANGED = H7
Public Const DBT_QUERYCHANGECONFIG = H17
Public Const DBT_USERDEFINED = HFFFF
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_DEVICECHANGE Then
Select Case m.WParam
Case WM_DEVICECHANGE
Case DBT_DEVICEARRIVAL 'U盤插入
ComboBox1.Items.Clear()
Dim s() As DriveInfo = DriveInfo.GetDrives
For Each drive As DriveInfo In s
If drive.DriveType = DriveType.Removable Then
ListBox1.Items.Add("U盤已插入!盤符為:" + drive.Name.ToString())
ComboBox1.Items.Add(drive.Name)
End If
Next
BtnWrite.Enabled = True
BtnRead.Enabled = True
Case DBT_CONFIGCHANGECANCELED
Case DBT_CONFIGCHANGED
Case DBT_CUSTOMEVENT
Case DBT_DEVICEQUERYREMOVE
Case DBT_DEVICEQUERYREMOVEFAILED
Case DBT_DEVICEREMOVECOMPLETE 'U盤卸載
ListBox1.Items.Add("U盤卸載!")
BtnWrite.Enabled = False
BtnRead.Enabled = False
Case DBT_DEVICEREMOVEPENDING
Case DBT_DEVICETYPESPECIFIC
Case DBT_DEVNODES_CHANGED
Case DBT_QUERYCHANGECONFIG
Case DBT_USERDEFINED
End Select
End If
MyBase.WndProc(m)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("請(qǐng)您現(xiàn)在插入U(xiǎn)盤至USB接口!")
End Sub
Private Sub BtnWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnWrite.Click
If ComboBox1.Text = "" Then
MsgBox("請(qǐng)選擇U盤盤符!", MsgBoxStyle.Exclamation, "Warn")
Else
Dim Writer As StreamWriter = Nothing
Try
Dim fileName As String = ComboBox1.Text + "Test.txt"
Writer = New StreamWriter(fileName)
Writer.WriteLine(InputBox("老四,請(qǐng)輸入要保存的字符串", "輸入信息", "Input then Test String! hehe!"))
MsgBox("Write to " + fileName + " Success!")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Write 失敗")
Finally
If Writer IsNot Nothing Then Writer.Close()
End Try
End If
End Sub
Private Sub BtnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRead.Click
If ComboBox1.Text = "" Then
MsgBox("請(qǐng)選擇U盤盤符!", MsgBoxStyle.Exclamation, "Warn")
Else
Dim Reader As StreamReader = Nothing
Try
Dim fileName As String = ComboBox1.Text + "Test.txt"
Reader = New StreamReader(fileName)
MsgBox("Read from " + fileName + vbCrLf + Reader.ReadToEnd, MsgBoxStyle.Information, "Info")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Read 失敗")
Finally
If Reader IsNot Nothing Then Reader.Close()
End Try
End If
End Sub
End Class
VB可用MsComm控件讀取來自USB轉(zhuǎn)RS232接口的數(shù)據(jù)。或者使用Winsock 控件接收來自USB網(wǎng)卡的數(shù)據(jù)。
MSComm 控件通過串行端口傳輸和接收數(shù)據(jù),為應(yīng)用程序提供串行通訊功能。
利用 WinSock 控件可以與遠(yuǎn)程計(jì)算機(jī)建立連接,并通過用戶數(shù)據(jù)文報(bào)協(xié)議 (UDP)或者傳輸控制協(xié)議
(TCP)進(jìn)行數(shù)據(jù)交換。這兩種協(xié)議都可以用來創(chuàng)建客戶與服務(wù)器應(yīng)用程序。
網(wǎng)頁名稱:關(guān)于vb.netusb的信息
分享地址:http://chinadenli.net/article16/doddcdg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、網(wǎng)站策劃、品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站導(dǎo)航、網(wǎng)站建設(shè)、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)