|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||USB||MBS USB Plugin||7.5||No||Yes||No||Yes, Windows only||No|
dim m as new WinHIDMBS
dim s as string
#if not TargetWin32
MsgBox "This example requires Windows."
if m.FindFirstDevice then
if left(m.Product,3)="RF1" then // my test device
if m.Connect then
// write 9 bytes report
// first byte is report ID plus 8 byte data
MsgBox "Send bytes: "+str(m.SendMessage(s))
loop until lenb(s)>0 // until we got something
MsgBox midb(s,2) // shows result. First byte is ReportID again
loop until not m.FindNextDevice
Title=str(ListBox1.ListCount)+" devices found."
For newer development, please use our HIDAPIMBS class.
Updated in version 10.4 of plugins to ignore devices which you don't have permissions to access them. So you will now see devices with VendorID=0 and ProductID=0.
This class can be used in three different ways. First normal with Connect and ReadMessage/SendMessage. Second with InstallListener and SendMessage/Poll functions. Third low level via GetInputReport and SetOutputReport.
- 10 properties
- property FeatureReportByteLength as Integer
- property HidHandle as Integer
- property InputReportByteLength as Integer
- property Lasterror as Integer
- property LasterrorString as String
- property OutputReportByteLength as Integer
- property PnPHandle as Integer
- property ReadHandle as Integer
- property ThreadHandle as Integer
- property WriteHandle as Integer
- 21 methods
- method Close
- method Connect as boolean
- method DevicePath as string
- method Disconnect
- method FindFirstDevice as boolean
- method FindNextDevice as boolean
- method GetInputReport(data as MemoryBlock, Offset as Integer = 0, Length as Integer = 0) as boolean
- method InstallListener(PollSize as Integer) as boolean
- method Manufacturer as string
- method PollMemory as memoryblock
- method PollString as string
- method Product as string
- method ProductID as Integer
- method ReadMessage(length as Integer, timeOut as Integer = 0) as string
- method ReadMessageMemory(length as Integer, timeOut as Integer = 0) as memoryblock
- method SendMessage(data as string) as Integer
- method SendMessageMemory(data as memoryblock, Offset as Integer = 0, length as Integer = 0) as Integer
- method SerialNumber as string
- method SetOutputReport(data as MemoryBlock, Offset as Integer = 0, Length as Integer = 0) as boolean
- method VendorID as Integer
- method VersionNumber as Integer
This class has no sub classes.
Some examples which use this class:
The items on this page are in the following plugins: MBS USB Plugin.
MBS Xojo Plugins