Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Erich VB

[Resolvido] Como retorno o registro do HD?

Recommended Posts

Veja se esta API te server: GetVolumeInformation.

Procure no google.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Obrigado pela dica scorpio. Encontrei.

:)

 

‘ General

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

 

 

Public Function DriveSerialNumber(Optional strDrive As String = "c:\") As String

Dim X As Long

Dim lngSerialNum As Long

Dim strRoot As String

 

If Trim(strDrive) = "" Then Exit Function

X = GetVolumeInformation(Left(strDrive, 1) & ":\", vbNullString, 0, lngSerialNum, 0, 0, vbNullString, 0)

DriveSerialNumber = Hex(lngSerialNum)

End Function

 

 

Private Sub Command2_Click()

Text8.Text = DriveSerialNumber("C:\")

 

End Sub

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.