I've been editing the USB HID code for VB.net to work with a PIC 4550 micro and got things mostly working, but I have a few problems.
1. One feature that I want is for the device to be detected automatically when I plug it in (even after the program is running) rather than having to click the Find My Device button. I tried to put Findthehid() into the OnDeviceChange sub, but I found that m.WParam.ToInt32 = 7 and DBT_DEVICEARRIVAL = 32768 so the program thinks no device has been attached.
2. The second problem is related to the first. If I plug the device in before I start the program then everything runs fine. When I unplug the device, I get an unexpected exception in module Hid, method DangerousAddRef. The exception is Safe handle has been closed.
Any suggestions on how to track down the cause of these problems would be appreciated.