Вопрос
Как получить серийные номера устройств подключенных к компьютеру? Если можно пример на VBA?
Ответ
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 Private Sub GetInfoAboutDriveC() Dim Serial As Long,
VName As String,
FSName As String 'Create buffers VName = String$(255, Chr$(0)) FSName = String$(255, Chr$(0)) 'Get the volume information GetVolumeInformation "C:\",
VName, 255,
Serial, 0, 0, FSName, 255 'Strip the extra chr$(0)'s VName = Left$(VName,
InStr(1, VName, Chr$(0)) — 1) FSName = Left$(FSName,
InStr(1, FSName, Chr$(0)) — 1) MsgBox "The Volume name of C:\ is '" + VName + "', the File system name of C:\ is '" + FSName + "' and the serial number of C:\ is '" +
Trim(Str$(Serial)) +
"'", vbInformation + vbOKOnly,
App.Title End Sub
Из конференции Expert_FAQ
Copyright 2000-2004 Сообщество Чайников
Контактная информация