Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
FormMain.frm
Package: USBFM.zip [view]
Upload User: wang202020
Upload Date: 2021-02-07
Package Size: 182k
Code Size: 4k
Category:
SCM
Development Platform:
HTML/CSS
- VERSION 5.00
- Begin VB.Form MainForm
- BorderStyle = 3 'Fixed Dialog
- Caption = "EasyHID Template"
- ClientHeight = 1485
- ClientLeft = 5490
- ClientTop = 4080
- ClientWidth = 3930
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1485
- ScaleWidth = 3930
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 615
- Left = 1440
- TabIndex = 0
- Top = 480
- Width = 975
- End
- End
- Attribute VB_Name = "MainForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' vendor and product IDs
- Private Const VendorID = 6017
- Private Const ProductID = 2000
- ' read and write buffers
- Private Const BufferInSize = 8
- Private Const BufferOutSize = 8
- Dim bufferin(0 To BufferInSize) As Byte
- Dim BufferOut(0 To BufferOutSize) As Byte
- Private Sub Command1_Click()
- hidReadEx VendorID, ProductID, BufferOut(0)
- End Sub
- ' ****************************************************************
- ' when the form loads, connect to the HID controller - pass
- ' the form window handle so that you can receive notification
- ' events...
- '*****************************************************************
- Private Sub Form_Load()
- ' do not remove!
- ConnectToHID (Me.hwnd)
- End Sub
- '*****************************************************************
- ' disconnect from the HID controller...
- '*****************************************************************
- Private Sub Form_Unload(Cancel As Integer)
- DisconnectFromHID
- End Sub
- '*****************************************************************
- ' a HID device has been plugged in...
- '*****************************************************************
- Public Sub OnPlugged(ByVal pHandle As Long)
- If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
- ' ** YOUR CODE HERE **
- End If
- End Sub
- '*****************************************************************
- ' a HID device has been unplugged...
- '*****************************************************************
- Public Sub OnUnplugged(ByVal pHandle As Long)
- If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
- ' ** YOUR CODE HERE **
- End If
- End Sub
- '*****************************************************************
- ' controller changed notification - called
- ' after ALL HID devices are plugged or unplugged
- '*****************************************************************
- Public Sub OnChanged()
- Dim DeviceHandle As Long
- ' get the handle of the device we are interested in, then set
- ' its read notify flag to true - this ensures you get a read
- ' notification message when there is some data to read...
- DeviceHandle = hidGetHandle(VendorID, ProductID)
- hidSetReadNotify DeviceHandle, True
- End Sub
- '*****************************************************************
- ' on read event...
- '*****************************************************************
- Public Sub OnRead(ByVal pHandle As Long)
- ' read the data (don't forget, pass the whole array)...
- If hidRead(pHandle, bufferin(0)) Then
- ' ** YOUR CODE HERE **
- ' first byte is the report ID, e.g. BufferIn(0)
- ' the other bytes are the data from the microcontrolller...
- End If
- End Sub
- '*****************************************************************
- ' this is how you write some data...
- '*****************************************************************
- Public Sub WriteSomeData()
- BufferOut(0) = 0 ' first by is always the report ID
- BufferOut(1) = 10 ' first data item, etc etc
- ' write the data (don't forget, pass the whole array)...
- hidWriteEx VendorID, ProductID, BufferOut(0)
- End Sub