Code:
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
'Br-Naziv diska "C:\")
Function BrojP(Br As String) As String
Dim Root As String
Dim Vol_N As String
Dim Ser_Br As Long
Dim Flag As Long
Dim Sys_Ime As String
Dim Pos As Integer
Dim Max_duz
Root = Br
Vol_N = Space$(1024)
Sys_Ime = Space$(1024)
If GetVolumeInformation(Root, Vol_N, _
Len(Vol_N), Ser_Br, _
Max_duz, Flag, _
Sys_Ime, Len(Sys_Ime)) = 0 _
Then
MsgBox "Greška pri definisanju broja"
Exit Function
End If
Pos = InStr(Vol_N, Chr$(0))
Vol_N = Left$(Vol_N, Pos - 1)
BrojP = Ser_Br
End Function
zxz