PEGAR NRO DE HD

USUARIO.EXCLUIDOS 08/07/2005 08:08:46
#92845
galera..Me desculpem, eu sei que tem aqui no site, mas infelizmente não achei. COmo pego o nro do HD pelo VB ?

Obrigado !!!
WEBER 08/07/2005 08:28:57
#92849
Resposta escolhida
amigo os links abaixo, caso não consiga me avise q a noite eu te mando um exemplo q estou usando ....

[txt-color=#ff0000]EXEMPLO1[/txt-color]

[txt-color=#0000ff]EXEMPLO2[/txt-color]
FABIO.ALEXANDRE 08/07/2005 08:33:31
#92851
BOM , ACHO Q ESSA API VAI TE SERVIR

Public 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

============================== FUNCTION Q FAZ O TRATAMENTO

Public Function fc_Get_Number_serie_HD(ByVal par_cunid As String) As String

Dim var_SerialNumber As Long
Dim par_cNameVolume As String * 255
Dim par_cNameSystem As String * 255

On Error GoTo erro_

Call GetVolumeInformation(par_cunid, par_cNameVolume, Len(par_cNameVolume), var_SerialNumber, 0, 0, par_cNameSystem, Len(par_cNameSystem))
fc_Get_Number_serie_HD = Hex$(var_SerialNumber)
fc_Get_Number_serie_HD = Left$(fc_Get_Number_serie_HD, 4) & "#" & Right$(fc_Get_Number_serie_HD, 4)

Exit Function
erro_:
MsgBox Err.Description & " " & Err.Number, vbCritical, "Get_Number_serie_HD"
End Function
====================================================================

ESPERO TER AJUDADO
USUARIO.EXCLUIDOS 08/07/2005 10:19:03
#92885
Só me traz "0"....em todos os exemplos....teriam alguma idéia ?
CLAUDIOLUCROCHA 08/07/2005 10:42:27
#92891
Tenho este exemplo tambem

Dim lSerial as Long
Dim fso As New FileSystemObject, drvDrive As Drive

'Pega as informações do drive c:
Set drvDrive = fso.GetDrive(left(fso.GetDriveName("c:"), 2))

'Pega o número de série do HD
lSerial = drvDrive.SerialNumber

E não esqueça de adicionar aos references do seu projeto a seguinte biblioteca "Microsoft Scripting Runtime", senão não funciona
Tópico encerrado , respostas não são mais permitidas