I know that this reply comes a number of years after the question was asked, however, I feel that if I had known this four weeks ago I would have been further along in my process. What I have found is that the WinHIDMBS plugin works well if you do things right. The problem is that the support documents do not tell you what you need to know to get your project to work properly. I hope that what I have found works for you too.
If m.FindFirstDevice Then
Do
If m.VendorID=&h0001 Then // Find Correct Device
If m.Connect Then // Write 10 Byte Report (First Byte is Report ID Plus 9 Bytes Data)
s=chr(0)+chr(1)+chr(2)+chr(3)+chr(4)+chr(5)+chr(6)+chr(7)+chr(8)+chr(9)
i=m.SendMessage(s) [color=#4000BF]// These 2 Lines Are What Finally Got My[/color]
DelayMBS(0.3) [color=#4000BF]// Project to Work After Weeks of Frustration![/color]
Do
x=m.ReadMessage(27)
Loop Until lenb(x)>0 // Loop until we get something
MsgBox midb(x,2) // Show result in Message Box - First byte is ReportID again
m.Disconnect
End If
Else
MsgBox "PC-Peripheral Communication Error"
End If
Loop Until Not m.FindNextDevice
End If
I had sent an e-mail to MBS asking for help but got a reply which was:
First, you should start looking for errors. The WinHIDMBS class has Lasterror and LasterrorString properties.
Next, please check OutputReportByteLength for the block size you need to send (+ReportID byte).
Did you verify the device was found? Connect returns true?Since I do understand a little bit about programming and I had been able to connect and send a few bytes of data and had checked for error messages. This was no help to me I didn't go on for what could have been weeks of e-mail messages and an offer on their part to send a device and my code. I decided to get to work and figure things out for myself and find out why I was continuing to get no productive results and could not read a message from my device. The device I was trying to get to communicate with the WinHIDMSB plugin is a PIC microcontroller with Full Speed USB capability.
The two lines of code shown were totally necessary in order to get things to work.
i=m.SendMessage(s)
DelayMBS(0.3)
The delay made all of the difference. I experimented and found that 0.3 seconds works well, but a 0.2 second delay does not work. Also, it seems that you need to handle the m.SendMessage(s) variable for some reason. I'm not sure why, but, if you do not at least do something with it you will not the message you are trying to receive from your device.
I hope that what I have found and the weeks of experimenting might be able to help you in your project.
J. Post