Platforms to show: All Mac Windows Linux Cross-Platform

WinHIDMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class USB MBS USB Plugin 7.5 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
A class to work with HID devices on Windows.
Example
// This example needs a window with ListBox1.
Var m as new WinHIDMBS
Var s as string

#if not TargetWin32
MessageBox "This example requires Windows."
#endif

if m.FindFirstDevice then

do
ListBox1.AddRow ""

ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,0)=hex(m.ProductID)
ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,1)=hex(m.VendorID)
ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,2)=m.Product
ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,3)=m.Manufacturer
ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,4)=m.SerialNumber
ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,5)=hex(m.VersionNumber)

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
s=chr(0)+"P"+chr(0)+chr(0)+chr(0)+chr(0)+chr(0)+chr(0)+chr(0)

MessageBox "Send bytes: "+str(m.SendMessage(s))

do
s=m.ReadMessage(17)
loop until lenb(s)>0 // until we got something
MessageBox midb(s,2) // shows result. First byte is ReportID again

m.Disconnect
end if
end if

loop until not m.FindNextDevice

end if

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.

This class has no subclasses.

Blog Entries

Xojo Developer Magazine

Some examples using this class:


The items on this page are in the following plugins: MBS USB Plugin.


WinGestureInfoMBS   -   WinHTTPClientAutoProxyOptionsMBS


The biggest plugin in space...