I have a long-standing issue with PhidgetsMBS (which I love), to wit, that after my Xojo app using Phidgets has run on a Windows PC, the Phidgets Control Panel app will no longer run until I restart the machine. Windows briefly flickers the Phidgets Control Panel icon and then the app quits immediately. This is without my Xojo app running, i.e. I run it and then quit.
I can run my Xojo app an unlimited number of times and the Phidgets always work. I can run the Phidgets Control Panel an unlimited number of times and it always works, as long as I don’t run my Xojo app.
But once the Xojo app has run, Phidgets Control Panel will not, until I restart the PC.
Windows 10, Xojo 2021r2.1, MBS 24.1, Phidgets 22 latest release (I think).
Anyone else see this? Could it be that MBS is not releasing the Phidgets library or something?
I believe i’ve seen this before. You need to close/release the local phidgets as the local phidgets are exclusive to 1 instance.
So i guess .close on all phidgets and releaseLibrary should do the trick.
After that you can open the control panel again. Keeping it open is not the way since the local usb phidgets are exclusive, and thus the control panel would open them and your app can’t then. And vice versa.
I did not, because sadly they seem to not care about Xojo, even though they have programming examples for virtually every other language. I once wrote them telling them how great Xojo is and MBS, and they didn’t even reply.
Okay, with next pre-release, we get InstanceCount property. So you can put an if around it:
e.g.
Dim InstanceCount As Integer = PhidgetMBS.InstanceCount // shows 0
If InstanceCount > 0 Then
// something wrong. Still objects around!
Else
// explicit shutdown library
PhidgetMBS.finalize(0)
End If