|
-
May 24th, 2005, 04:18 AM
#1
Re: Hard disk ID
Sorry, this is the wrong section.
This section is a place where you can post code snippets others may find useful, you want the Classic Visual Basic forum 
And to answer your question try this:
VB Code:
Private Const DRIVE_CDROM As Long = 5
Private Sub Form_Load()
MsgBox [b]DriveSerial("C:\")[/b]
End Sub
Private Function DriveSerial(strDrive As String) As String
' Returns the drive serial number.
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If Len(strDrive) > 3 Then
Exit Sub
End If
If (FSO.GetDrive(strDrive).IsReady = True) And (Not GetDriveType(strDrive) = DRIVE_CDROM) Then
DriveSerial = CStr(FSO.GetDrive(strDrive).SerialNumber)
Else
DriveSerial = "Not Available"
End If
End Property
And there you go - I've included the DriveSerial wrapper function, it should make things easier when in code 
Cheers,
RyanJ
Last edited by Hack; May 24th, 2005 at 05:29 AM.
-
May 24th, 2005, 05:30 AM
#2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|