Thank you Steve and David.
The VB5/Express part was my hold up.
Thank you Steve and David.
The VB5/Express part was my hold up.
Dave
Always wear safety glasses while programming.
Thanks guys, don't forget to post your "It's working or not" comments...
As i write it, (~24 hours later) the template have been downloaded 76 times already
Finger crossed![]()
Last edited by mister_e; - 7th June 2007 at 02:13.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi,
Have been playing with this and it works great.
Only thing is that I can not get hidGetVendorName and hidGetProductName to work. I get an "Attempted to read or write protected memory" error with this and i'm not sure if im doing something wrong or that theres a problem with this .net version.
Thanks
Abnormal1
Yup, Yet another .NET thingy. 'Till now, i have found a way to make it work....
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.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
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.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks for that, it now works.
I expected it to be related to not using a fixed length string, however I had only tried to set the strings to Null rather than a load of spaces.
Anyway I have found that using the following is easier than counting how many time you press the spacebar
Code:Dim VendorName As String = New String(CChar(" "), 16)
Also in the code you posted I don't think that you need to call "hidGetHandle" as you already have that in the variable "pHandle".
here's a way to assign a fixed format string in dotnet
[HTML]<VBFixedString(15)> Public VendorName As String[/HTML]
you still need to load with character it so far... don't forget the Imports Sytem
Guys over there send me few links. Load of thing to learn/try with this new .NET. (marshallxxx, exception.. syntax, InteropService.. etc etc etc). Especially when dealing with API
I've also found few nice .CHM and .PDF on VB.NET and Express... RTFM sessions will begin... when i'll wake up. <hr>
EOM
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Amr Bekhit has modified it a little bit and added some documentation as well
USB HID Template for Visual Basic 2005
http://www.helmpcb.com/Software/USBHIDVB/USBHIDVB.aspx
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks