Results 1 to 3 of 3

Thread: Vb6 - detecting serial n° from a win 8.1 machine help needed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Question Vb6 - detecting serial n° from a win 8.1 machine help needed

    Dear all,

    I use the following code to detect serial n from USB devices and pcs, it works perfectly with the execptino with my win 8.1 machine, from some reason that I cant understand it cant read the serial from the hard disk.
    Pleas see the code:


    ____________________________________________________________________________________

    Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    Private Const BUFFER As Long = 256

    _____________________________________________________________________________________

    Private Function GetSerial() As String

    Dim strVolumeName As String * 256
    Dim strFileSystem As String * 256
    Dim lngSerialNumber As Long
    Dim lngReturn As Long

    Dim drivename As String
    drivename = Left(App.Path, 3)
    lngReturn = GetVolumeInformation(drivename, strVolumeName, BUFFER, lngSerialNumber, 0&, 0&, strFileSystem, BUFFER)

    If lngReturn Then

    GetSerial = Hex(Trim(lngSerialNumber))

    Else

    GetSerial = "NO INFO AVAILABLE "

    End If

    End Function
    __________________________________________________________________

    What should I change to make it work also for Win 8.1 ??
    thanks regards

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Vb6 - detecting serial n° from a win 8.1 machine help needed

    is the win 8.1 x32 or 64 bit?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Re: Vb6 - detecting serial n° from a win 8.1 machine help needed

    I think it's 32 bit, not sure right now cos I dont have my pc with me at the moment.
    The funny thing is that it reads the serial n° from all USB devices but not from the hard disk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width