Results 1 to 2 of 2

Thread: Serial Number of Hard Disk

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    Posts
    7

    Exclamation Serial Number of Hard Disk

    Hi Everyone!

    How can I get Serial Number of Hard Disk using Vb6

    Regards,

    Prashant
    Pacific

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    VB Code:
    1. 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
    2. Private Sub Form_Load()
    3. Dim Serial As Long, VName As String, FSName As String
    4.     'Create buffers
    5.     VName = String$(255, Chr$(0))
    6.     FSName = String$(255, Chr$(0))
    7.     'Get the volume information
    8.     GetVolumeInformation "C:\", VName, 255, Serial, 0, 0, FSName, 255
    9.     'Strip the extra chr$(0)'s
    10.     VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1)
    11.     FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1)
    12.     MsgBox "The Volume name of C:\ is '" + VName + "', the File system name of C:\ is '" + FSName + "' and the serial number of C:\ is '" + Trim(Str$(Serial)) + "'", vbInformation + vbOKOnly, App.Title
    13. End Sub
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

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