Yup, Yet another .NET thingy. 'Till now, i have found a way to make it work....
Code:
Public Sub OnPlugged(ByVal pHandle As Integer)
Dim DeviceHandle As Integer
' Mister E
Dim VendorName As String = " "
' USB Demo
Dim ProductName As String = " "
If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then ' Good one?
'
' get the device handle
' =====================
DeviceHandle = hidGetHandle(VendorID, ProductID)
'
' Get the vendor and product name from the handle
' ===============================================
hidGetVendorName(DeviceHandle, VendorName, 255)
hidGetProductName(DeviceHandle, ProductName, 255)
End If
Label2.Text = VendorName
label3.text = ProductName
The trick is to assign a value to VendorName and ProductName before calling hidGetVendorName and hidGetProductName. Make sure your space/blank character are at least equal to the LEN if VendorName and ProductName. Unless, it will screw up things.
VB.NET doesn't seems to have a way to determine a fixed String size...
Anyways, i've ask the question on the MSDN forum, let's see if there's a more elegant way to do it. It has to... In meantime, the above solution work.
Bookmarks