亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? frmmain.frm

?? vb下usb通訊的例子
?? FRM
?? 第 1 頁 / 共 2 頁
字號:
Dim ThisByte As Byte

For Offset = 0 To Bytes - 1
    Call RtlMoveMemory(ByVal VarPtr(ThisByte), ByVal Address + Offset, 1)
    If (ThisByte And &HF0) = 0 Then
        Result$ = Result$ & "0"
    End If
    Result$ = Result$ & Hex$(ThisByte) & " "
Next Offset

GetDataString = Result$
End Function

Private Function GetErrorString _
    (ByVal LastError As Long) _
As String

'Returns the error message for the last error.
'Adapted from Dan Appleman's "Win32 API Puzzle Book"

Dim Bytes As Long
Dim ErrorString As String
ErrorString = String$(129, 0)
Bytes = FormatMessage _
    (FORMAT_MESSAGE_FROM_SYSTEM, _
    0&, _
    LastError, _
    0, _
    ErrorString$, _
    128, _
    0)
    
'Subtract two characters from the message to strip the CR and LF.
If Bytes > 2 Then
    GetErrorString = Left$(ErrorString, Bytes - 2)
End If

End Function

Private Sub cmdContinuous_Click()
'Enables the user to select 1-time or continuous data transfers.

If cmdContinuous.Caption = "Continuous" Then
    'Change the command button to Cancel Continuous
    cmdContinuous.Caption = "Cancel Continuous"
    'Enable the timer to read and write to the device once/second.
    tmrContinuousDataCollect.Enabled = True
    Call ReadAndWriteToDevice
Else
    'Change the command button to Continuous
    cmdContinuous.Caption = "Continuous"
    'Disable the timer that reads and writes to the device once/second.
    tmrContinuousDataCollect.Enabled = False
End If

End Sub

Private Sub cmdOnce_Click()
Call ReadAndWriteToDevice
End Sub
Private Sub DisplayResultOfAPICall(FunctionName As String)

'Display the results of an API call.

Dim ErrorString As String

lstResults.AddItem ""
ErrorString = GetErrorString(Err.LastDllError)
lstResults.AddItem FunctionName
lstResults.AddItem "  Result = " & ErrorString

'Scroll to the bottom of the list box.
lstResults.ListIndex = lstResults.ListCount - 1

End Sub

Private Sub Form_Load()
frmMain.Show
tmrDelay.Enabled = False
Call Startup
End Sub

Private Sub Form_Unload(Cancel As Integer)
Call Shutdown
End Sub

Private Sub GetDeviceCapabilities()

'******************************************************************************
'HidD_GetPreparsedData
'Returns: a pointer to a buffer containing information about the device's capabilities.
'Requires: A handle returned by CreateFile.
'There's no need to access the buffer directly,
'but HidP_GetCaps and other API functions require a pointer to the buffer.
'******************************************************************************

Dim ppData(29) As Byte
Dim ppDataString As Variant

'Preparsed Data is a pointer to a routine-allocated buffer.
Result = HidD_GetPreparsedData _
    (HidDevice, _
    PreparsedData)
Call DisplayResultOfAPICall("HidD_GetPreparsedData")

'Copy the data at PreparsedData into a byte array.

Result = RtlMoveMemory _
    (ppData(0), _
    PreparsedData, _
    30)
Call DisplayResultOfAPICall("RtlMoveMemory")

ppDataString = ppData()
'Convert the data to Unicode.
ppDataString = StrConv(ppDataString, vbUnicode)

'******************************************************************************
'HidP_GetCaps
'Find out the device's capabilities.
'For standard devices such as joysticks, you can find out the specific
'capabilities of the device.
'For a custom device, the software will probably know what the device is capable of,
'so this call only verifies the information.
'Requires: The pointer to a buffer containing the information.
'The pointer is returned by HidD_GetPreparsedData.
'Returns: a Capabilites structure containing the information.
'******************************************************************************
Result = HidP_GetCaps _
    (PreparsedData, _
    Capabilities)

Call DisplayResultOfAPICall("HidP_GetCaps")
lstResults.AddItem "  Last error: " & ErrorString
lstResults.AddItem "  Usage: " & Hex$(Capabilities.Usage)
lstResults.AddItem "  Usage Page: " & Hex$(Capabilities.UsagePage)
lstResults.AddItem "  Input Report Byte Length: " & Capabilities.InputReportByteLength
lstResults.AddItem "  Output Report Byte Length: " & Capabilities.OutputReportByteLength
lstResults.AddItem "  Feature Report Byte Length: " & Capabilities.FeatureReportByteLength
lstResults.AddItem "  Number of Link Collection Nodes: " & Capabilities.NumberLinkCollectionNodes
lstResults.AddItem "  Number of Input Button Caps: " & Capabilities.NumberInputButtonCaps
lstResults.AddItem "  Number of Input Value Caps: " & Capabilities.NumberInputValueCaps
lstResults.AddItem "  Number of Input Data Indices: " & Capabilities.NumberInputDataIndices
lstResults.AddItem "  Number of Output Button Caps: " & Capabilities.NumberOutputButtonCaps
lstResults.AddItem "  Number of Output Value Caps: " & Capabilities.NumberOutputValueCaps
lstResults.AddItem "  Number of Output Data Indices: " & Capabilities.NumberOutputDataIndices
lstResults.AddItem "  Number of Feature Button Caps: " & Capabilities.NumberFeatureButtonCaps
lstResults.AddItem "  Number of Feature Value Caps: " & Capabilities.NumberFeatureValueCaps
lstResults.AddItem "  Number of Feature Data Indices: " & Capabilities.NumberFeatureDataIndices

'******************************************************************************
'HidP_GetValueCaps
'Returns a buffer containing an array of HidP_ValueCaps structures.
'Each structure defines the capabilities of one value.
'This application doesn't use this data.
'******************************************************************************

'This is a guess. The byte array holds the structures.
Dim ValueCaps(1023) As Byte

Result = HidP_GetValueCaps _
    (HidP_Input, _
    ValueCaps(0), _
    Capabilities.NumberInputValueCaps, _
    PreparsedData)
   
Call DisplayResultOfAPICall("HidP_GetValueCaps")

'lstResults.AddItem "ValueCaps= " & GetDataString((VarPtr(ValueCaps(0))), 180)
'To use this data, copy the byte array into an array of structures.

End Sub

Private Sub InitializeDisplay()
Dim Count As Integer
Dim ByteValue As String
'Create a dropdown list box for each byte to send.
For Count = 0 To 255
    If Len(Hex$(Count)) < 2 Then
        ByteValue = "0" & Hex$(Count)
    Else
        ByteValue = Hex$(Count)
    End If
    frmMain.cboByte0.AddItem ByteValue, Count
Next Count
For Count = 0 To 255
    If Len(Hex$(Count)) < 2 Then
        ByteValue = "0" & Hex$(Count)
    Else
        ByteValue = Hex$(Count)
    End If
    frmMain.cboByte1.AddItem ByteValue, Count
Next Count
'Select a default item for each box
frmMain.cboByte0.ListIndex = 0
frmMain.cboByte1.ListIndex = 128
End Sub

Private Sub ReadAndWriteToDevice()
'Sends two bytes to the device and reads two bytes back.

Dim DeviceDetected As Boolean

'Report Header
lstResults.AddItem "HID Test Report"
lstResults.AddItem Format(Now, "general date")

'Some data to send
'(if not using the combo boxes):
'OutputReportData(0) = &H12
'OutputReportData(1) = &H34
'OutputReportData(2) = &HF0
'OutputReportData(3) = &HF1
'OutputReportData(4) = &HF2
'OutputReportData(5) = &HF3
'OutputReportData(6) = &HF4
'OutputReportData(7) = &HF5

'Get the bytes to send from the combo boxes.
'Increment the values if the autoincrement check box is selected.
If chkAutoincrement.Value = 1 Then
    If cboByte0.ListIndex < 255 Then
        cboByte0.ListIndex = cboByte0.ListIndex + 1
    Else
        cboByte0.ListIndex = 0
    End If
    If cboByte1.ListIndex < 255 Then
        cboByte1.ListIndex = cboByte1.ListIndex + 1
    Else
        cboByte1.ListIndex = 0
    End If
End If

OutputReportData(0) = cboByte0.ListIndex
OutputReportData(1) = cboByte1.ListIndex

'Find the device
DeviceDetected = FindTheHid
If DeviceDetected = True Then
    'Learn the capabilities of the device
    Call GetDeviceCapabilities
    'Write a report to the device
    Call WriteReport
    
    'The firmware adds 1 to each received byte and sends the bytes back
    'to the host.
    'Add a delay to allow the host time to poll for the returned data.
    Timeout = False
    tmrDelay.Interval = 100
    tmrDelay.Enabled = True
    Do
        DoEvents
    Loop Until Timeout = True
    'Read a report from the device.
    Call ReadReport
Else
End If

'Scroll to the bottom of the list box.
lstResults.ListIndex = lstResults.ListCount - 1

End Sub

Private Sub ReadReport()

'Read data from the device.

Dim Count
Dim NumberOfBytesRead As Long
'Allocate a buffer for the report.
'Byte 0 is the report ID.
Dim ReadBuffer() As Byte
Dim UBoundReadBuffer As Integer

'******************************************************************************
'ReadFile
'Returns: the report in ReadBuffer.
'Requires: a device handle returned by CreateFile,
'the Input report length in bytes returned by HidP_GetCaps.
'******************************************************************************

'ReadFile is a blocking call. The application will hang until the device
'sends the requested amount of data. To prevent hanging, be sure that
'the device always has data to send.

Dim ByteValue As String
'The ReadBuffer array begins at 0, so subtract 1 from the number of bytes.
ReDim ReadBuffer(Capabilities.InputReportByteLength - 1)
    
'Pass the address of the first byte of the read buffer.
Result = ReadFile _
    (HidDevice, _
    ReadBuffer(0), _
    CLng(Capabilities.InputReportByteLength), _
    NumberOfBytesRead, _
    0)
Call DisplayResultOfAPICall("ReadFile")

lstResults.AddItem " Report ID: " & ReadBuffer(0)
lstResults.AddItem " Report Data:"

txtBytesReceived.Text = ""
For Count = 1 To UBound(ReadBuffer)
    'Add a leading 0 to values 0 - Fh.
    If Len(Hex$(ReadBuffer(Count))) < 2 Then
        ByteValue = "0" & Hex$(ReadBuffer(Count))
    Else
        ByteValue = Hex$(ReadBuffer(Count))
    End If
    lstResults.AddItem " " & ByteValue
    'Display the received bytes in the text box.
    txtBytesReceived.SelStart = Len(txtBytesReceived.Text)
    txtBytesReceived.SelText = ByteValue & vbCrLf
    
Next Count
End Sub

Private Sub Shutdown()
'Includes actions that must execute when the program ends.

'Close the open handle to the device.
Result = CloseHandle _
    (HidDevice)
Call DisplayResultOfAPICall("CloseHandle (HidDevice)")

'Free memory used by SetupDiGetClassDevs
'Nonzero = success
Result = SetupDiDestroyDeviceInfoList _
    (DeviceInfoSet)
Call DisplayResultOfAPICall("DestroyDeviceInfoList")

Result = HidD_FreePreparsedData _
    (PreparsedData)
Call DisplayResultOfAPICall("HidD_FreePreparsedData")

End Sub

Private Sub Startup()
Call InitializeDisplay
tmrContinuousDataCollect.Enabled = False
tmrContinuousDataCollect.Interval = 1000
End Sub

Private Sub tmrContinuousDataCollect_Timer()
Call ReadAndWriteToDevice

End Sub

Private Sub tmrDelay_Timer()
Timeout = True
tmrDelay.Enabled = False
End Sub

Private Sub WriteReport()
'Send data to the device.

Dim Count As Integer
Dim NumberOfBytesRead As Long
Dim NumberOfBytesToSend As Long
Dim NumberOfBytesWritten As Long
Dim ReadBuffer() As Byte
Dim SendBuffer() As Byte

'The SendBuffer array begins at 0, so subtract 1 from the number of bytes.
ReDim SendBuffer(Capabilities.OutputReportByteLength - 1)

'******************************************************************************
'WriteFile
'Sends a report to the device.
'Returns: success or failure.
'Requires: the handle returned by CreateFile and
'The output report byte length returned by HidP_GetCaps
'******************************************************************************

'The first byte is the Report ID
SendBuffer(0) = 0

'The next bytes are data
For Count = 1 To Capabilities.OutputReportByteLength - 1
    SendBuffer(Count) = OutputReportData(Count - 1)
Next Count

NumberOfBytesWritten = 0

Result = WriteFile _
    (HidDevice, _
    SendBuffer(0), _
    CLng(Capabilities.OutputReportByteLength), _
    NumberOfBytesWritten, _
    0)
Call DisplayResultOfAPICall("WriteFile")

lstResults.AddItem " OutputReportByteLength = " & Capabilities.OutputReportByteLength
lstResults.AddItem " NumberOfBytesWritten = " & NumberOfBytesWritten
lstResults.AddItem " Report ID: " & SendBuffer(0)
lstResults.AddItem " Report Data:"

For Count = 1 To UBound(SendBuffer)
    lstResults.AddItem " " & Hex$(SendBuffer(Count))
Next Count

End Sub

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品在线一区二区三区| 欧美午夜精品久久久久久超碰 | 成人在线综合网| 91麻豆精品在线观看| 日韩色在线观看| 亚洲综合小说图片| 成人免费福利片| 久久久久亚洲蜜桃| 日本不卡的三区四区五区| 色综合久久中文综合久久牛| 久久久三级国产网站| 青青草一区二区三区| 欧美日韩大陆一区二区| 亚洲女爱视频在线| 99久久久久免费精品国产 | 国产精品嫩草久久久久| 久久电影国产免费久久电影| 欧美三级韩国三级日本三斤| **欧美大码日韩| 成人在线一区二区三区| 国产午夜三级一区二区三| 国产一区二三区好的| 日韩欧美激情一区| 经典三级一区二区| 久久香蕉国产线看观看99| 久久精品99久久久| 精品国产1区二区| 精品在线播放免费| 精品国产一区久久| 国产一区在线观看麻豆| 精品久久久久久亚洲综合网| 国产在线精品一区二区夜色 | 日本高清视频一区二区| 又紧又大又爽精品一区二区| 一本色道综合亚洲| 一区二区三区**美女毛片| 色悠悠久久综合| 亚洲一级二级三级| 欧美日韩一级黄| 麻豆国产精品官网| wwwwxxxxx欧美| www.综合网.com| 亚洲免费观看高清在线观看| 91成人免费电影| 亚洲va在线va天堂| 91精品国产欧美一区二区18| 日韩成人一区二区三区在线观看| 欧美老女人第四色| 国产一区视频在线看| 国产精品网站在线播放| 91在线国内视频| 香蕉久久一区二区不卡无毒影院| 欧美久久久久久久久中文字幕| 美国毛片一区二区三区| 国产亚洲精品7777| 欧美午夜宅男影院| 国产精品一区三区| 一区二区不卡在线播放| 欧美一区二区福利在线| 成人国产电影网| 婷婷中文字幕一区三区| 国产欧美日韩中文久久| 日本高清成人免费播放| 黄页视频在线91| 亚洲少妇30p| 精品免费国产一区二区三区四区| www.一区二区| 久久激情五月激情| 一区二区国产视频| 久久久久国产精品厨房| 欧美三区在线观看| 国产成人免费视频精品含羞草妖精| 亚洲精品免费看| 久久精品亚洲精品国产欧美 | 肉肉av福利一精品导航| 久久人人爽人人爽| 制服丝袜亚洲色图| 99精品久久久久久| 国产精品一区二区在线看| 一区二区激情视频| 国产精品污www在线观看| 日韩三级视频在线看| 色婷婷国产精品久久包臀| 国产一区二区在线免费观看| 亚洲国产精品影院| 国产精品免费视频网站| 精品日韩在线观看| 欧美一级精品在线| 欧美日韩视频在线第一区| www.亚洲色图| 成人黄色免费短视频| 国产一区视频导航| 蜜桃视频在线观看一区二区| 亚洲综合精品久久| 1区2区3区精品视频| 国产日韩欧美制服另类| 欧美不卡123| 日韩精品在线一区二区| 91精品久久久久久蜜臀| 欧美亚洲动漫精品| 在线观看亚洲精品视频| 91看片淫黄大片一级在线观看| 国产精品一品二品| 国产一区二区三区不卡在线观看| 日本亚洲天堂网| 日韩vs国产vs欧美| 日韩国产欧美在线观看| 天天综合色天天综合| 亚洲成人在线免费| 石原莉奈在线亚洲三区| 午夜精品福利视频网站| 午夜电影网亚洲视频| 午夜视频一区二区三区| 天天色综合天天| 免费观看在线色综合| 青青草原综合久久大伊人精品优势| 日韩经典中文字幕一区| 麻豆国产精品官网| 国产真实乱偷精品视频免| 国产永久精品大片wwwapp| 国产伦精品一区二区三区视频青涩| 久久精品国产亚洲5555| 国产精品18久久久久久久久| 国产成人在线影院| 99riav久久精品riav| 在线观看视频91| 日韩一本二本av| 国产天堂亚洲国产碰碰| 亚洲欧洲另类国产综合| 亚洲欧美日韩国产手机在线| 亚洲高清中文字幕| 日韩av一级电影| 国产在线不卡一区| 91丨九色丨黑人外教| 欧美日韩在线综合| 亚洲精品一区二区三区精华液 | 欧美日精品一区视频| 欧美一区二区性放荡片| 久久女同性恋中文字幕| 亚洲欧洲av在线| 天堂一区二区在线免费观看| 久久精品免费看| av日韩在线网站| 欧美妇女性影城| 久久综合九色综合97婷婷| 成人欧美一区二区三区黑人麻豆| 亚洲乱码国产乱码精品精的特点| 亚洲成人av电影在线| 国产一区二区三区四区五区美女| 国产精品996| 欧美日韩视频在线第一区| 国产香蕉久久精品综合网| 亚洲在线中文字幕| 国产传媒日韩欧美成人| 在线精品视频免费播放| 久久久久久麻豆| 亚洲图片欧美视频| 粗大黑人巨茎大战欧美成人| 欧美日韩国产小视频在线观看| 国产日韩欧美a| 日日夜夜免费精品| av亚洲产国偷v产偷v自拍| 日韩亚洲欧美综合| 亚洲一区在线观看免费| 国产一级精品在线| 777xxx欧美| 一区二区高清免费观看影视大全| 国产一区二区三区蝌蚪| 欧美精品视频www在线观看| 亚洲欧洲美洲综合色网| 国产一区二区三区视频在线播放| 欧美久久一区二区| 亚洲免费在线视频一区 二区| 国产曰批免费观看久久久| 欧美另类z0zxhd电影| 洋洋av久久久久久久一区| 丁香婷婷综合五月| 久久久久久久久蜜桃| 免费在线看成人av| 5858s免费视频成人| 亚洲影视在线播放| 91香蕉视频污| 欧美国产禁国产网站cc| 国产在线日韩欧美| 2023国产精品视频| 国产一区视频导航| 久久久久97国产精华液好用吗| 日产精品久久久久久久性色| 欧美日韩在线精品一区二区三区激情| 中文字幕日韩一区二区| 大尺度一区二区| 中文字幕一区二区三区视频| 国产呦精品一区二区三区网站| 日韩美女天天操| 国产一区视频在线看| 国产女同性恋一区二区| 高清不卡一区二区| 国产精品二三区| 日本电影欧美片| 亚洲123区在线观看|