Comando DOS desde Visual Basic

Hola, estamos en un proyecto que requiere conocer el No. De serie del Volumen de la unidad C:, hemos utilizado la función Dir, pero solo nos da la etiqueta de volumen. ¿Conoces alguna instrucción o método para lograrlo?
Gracias de Antemano!
Respuesta
1
(EJEMPLO SACADO DE LA AYUDA DE VB6 - Uso de la propiedad SerialNumber del objeto Drive)
---------------
Option Explicit
Private Sub Form_Load()
ShowDriveInfo "C:"
End Sub
Sub ShowDriveInfo(drvpath)
Dim fs, d, s, t
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
Select Case d.DriveType
Case 0: t = "Desconocido"
Case 1: t = "Separable"
Case 2: t = "Fijo"
Case 3: t = "Red"
Case 4: t = "CD-ROM"
Case 5: t = "Disco RAM "
End Select
s = "Unidad " & d.DriveLetter & ": - " & t
s = s & vbCrLf & "NS: " & d.SerialNumber
MsgBox s
End Sub
----------------
Copia este codigo en un form.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas