真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

包含vbnetusb的詞條

VB.NET檢測(cè)插入U(xiǎn)盤(pán)時(shí)執(zhí)行某段代碼,并能獲取U盤(pán)盤(pán)符

以下內(nèi)容為網(wǎng)絡(luò)提供,但我自己驗(yàn)證可行,供你參考.

成都創(chuàng)新互聯(lián)公司從2013年成立,先為定興等服務(wù)建站,定興等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢(xún)服務(wù)。為定興企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wè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盤(pán)插入

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盤(pán)已插入!盤(pán)符為:" + 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盤(pán)卸載

ListBox1.Items.Add("U盤(pán)卸載!")

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)盤(pá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盤(pán)盤(pán)符!", 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盤(pán)盤(pán)符!", 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

關(guān)于VB和USB

如果是USB轉(zhuǎn)串口,那么還用mscomm控件,如果不是,那就問(wèn)生產(chǎn)廠(chǎng)家要通訊協(xié)議。

vb.net 讀取掃描槍USB接口數(shù)據(jù)的實(shí)例

USB比較難抓數(shù)據(jù),建議是USB模擬串口,或者直接就是串口,這樣數(shù)據(jù)比較好抓。

USB上傳模式是鼠標(biāo)光標(biāo)在哪數(shù)據(jù)就上傳在哪,所以你抓USB的數(shù)據(jù)的很難!

X貓-思刊辦公專(zhuān)營(yíng)店

VB.NET怎樣把USB攝像頭在顯示器上輸出的實(shí)時(shí)畫(huà)面(像素信息),引入到數(shù)據(jù)庫(kù).

用directshow獲取幀緩存,轉(zhuǎn)換為標(biāo)準(zhǔn)圖像格式(比如jpg,png這些),存儲(chǔ)到數(shù)據(jù)庫(kù)的image字段里就行了.


網(wǎng)頁(yè)題目:包含vbnetusb的詞條
鏈接URL:http://weahome.cn/article/hspojs.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部