[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

07/15/2009 at 03:28PM PDT, ID: 24574066
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

How to Find USB device serial Number in VB.NET

Asked by kkp01 in .NET Framework 1.x, Microsoft Visual Basic.Net, .NET

Tags: USB device discriptor Serial Number

I have found a VB code to find the serial number of an USB device at http://omnibus.uni-freiburg.de/~albers/snippets/usbinfo10.zip. I have not tried it in VB as I want to use the code in VB.NET. However converting it in VB.NET, I had to change many of things in it. Some how I managed to resolve all the complier errors. But executing the application gives runtime error. "arithmetic operation result in an overflow" at the place shown in the following extract of code. Possibly it may be overflow caused by constant value of "&HC30C" assigned to a SHORT datatype.
So, whether the "&HC30C" value is correct ?
whether VB.NET compitible code of USBINFO10 is available ?
Can experts help me to convert USBINFO10 code in to VB.NET ?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
Private Structure typGUID ' 10h/16 bytes, no paddings
        Public lData1 As Integer ' +00-03:  DWORD
        Public iData2 As Short  ' +04-05:  WORD
        Public iData3 As Short ' +06-07:  WORD
        <VBFixedString(8), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=8)> Public abData4() As Byte		
    End Structure
.....
..... 
GUID_CLASS_USBHUB = DEFINE_GUID(&HF18A0E88, &HC30C, &H11D0, &H88, &H15, &H0, &HA0, &HC9, &H6, &HBE, &HD8)
....
.....
Private Function DEFINE_GUID(ByVal lData1 As Integer, ByVal iData2 As Integer, ByVal iData3 As Short, ByVal bData4_1 As Byte, ByVal bData4_2 As Byte, ByVal bData4_3 As Byte, ByVal bData4_4 As Byte, ByVal bData4_5 As Byte, ByVal bData4_6 As Byte, ByVal bData4_7 As Byte, ByVal bData4_8 As Byte) As typGUID
 
        Dim GUIDTMP As typGUID
 
        'following 1 line added to resolve null pointer error 
        GUIDTMP.abData4 = New Byte() {0, 0, 0, 0, 0, 0, 0, 0}
 
        With GUIDTMP
            .lData1 = lData1
            .iData2 = iData2    ' <-----  geting overflow error here
            .iData3 = iData3
            .abData4(0) = bData4_1
            .abData4(1) = bData4_2
            .abData4(2) = bData4_3
            .abData4(3) = bData4_4
            .abData4(4) = bData4_5
            .abData4(5) = bData4_6
            .abData4(6) = bData4_7
            .abData4(7) = bData4_8
        End With
 
               DEFINE_GUID = GUIDTMP
 
    End Function
[+][-]07/15/09 03:36 PM, ID: 24864850

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/09 10:46 PM, ID: 24866645

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/22/09 06:42 AM, ID: 24914713

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07/22/09 06:42 AM, ID: 24914720

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07/22/09 08:50 AM, ID: 24916475

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET Framework 1.x, Microsoft Visual Basic.Net, .NET
Tags: USB device discriptor Serial Number
Sign Up Now!
Solution Provided By: TheLearnedOne
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20090701_SELECT_ZONES