Page 1 of 1

Detecting an attached IFK under COM

Posted: Wed Sep 04, 2013 12:35 pm
by Jim Mack
In a VB6 application using the COM dll, I need to detect on startup whether an module is attached to the USB port. I've tried this using WithEvents and without, no difference

It seems obvious that the .IsAttached property would provide this information, but it doesn't. I notice in the examples that uses of this property during Form_Load etc are commented out, and indeed when they're uncommented, fail to work (.IsAttached is always false, etc).

The same seems to be true of other properties that would be helpful, like .SerialNumber etc. They only seem to function if read in the _OnAttach event.

The problem is that if no module is attached on startup (or if WithEvents isn't used), no _OnAttach event occurs and so there's no way to detect an unconnected module.

What am I missing?