VB 6.0
2012.08.07 14:22
HDD 볼륨키 가져오는 함수
다물칸 주소복사
조회 수 3416 추천 수 0 댓글 0
구분 | 팁&트릭 |
---|
Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" ( _ ByVal lpRootPathName As String, _ ByVal lpVolumeNameBuffer As String, _ ByVal nVolumeNameSize As Long, _ ByRef lpVolumeSerialNumber As Long, _ ByRef lpMaximumComponentLength As Long, _ ByRef lpFileSystemFlags As Long, _ ByVal lpFileSystemNameBuffer As String, _ ByVal nFileSystemNameSize As Long _ ) As Long Public Function ProcGetVolKey(sDrive As String) As String On Error GoTo err Dim nVS As Long If GetVolumeInformation(sDrive & ":\", vbNullString, 0&, nVS, ByVal 0&, ByVal 0&, vbNullString, 0&) Then ProcGetVolKey = Left$(Hex$(nVS), 4) & "-" & Mid$(Hex$(nVS), 5, 4) Else ProcGetVolKey = "0000-0000" End If Exit Function err: ProcGetVolKey = "0000-0000" End Function