Hi. First, sorry on my weak English to all. Qusetion: How to read (in VB) Manufacturer serial number of Hard disk drive? Not volume/serial number of C:, D:, etc. partitons. For reading volume/serial number of hard disk C: etc, You can use Microsoft Scripting Runtime (in VB): Dim ff As New Scripting.FileSystemObject Dim drv As Drive Set drv = ff.GetDrive('C') SerialNumber = drv.SerialNumber MsgBox 'Serial/Volume number of C: is ' + Trim(Str(SerialNumber)) But, I need manufacturer serial number of hard disk drive, because, after formatting hard disk You'll get another volume/serial number, and that is very bad if my program should check that parameter, if he can't recognize that this HDD is the same one but only formatted (and after formatting there is set another volume/serial number). How I see, many people swap meaning of volume and serial number of some drive. Thx to all.
Hi there, Kindly refer to below attached code segment, hope it helps. Good luck & take care. API declaration
Option Explicit
Private Declare Function GetVolumeInformation& Lib 'kernel32' _
Alias 'GetVolumeInformationA' (ByVal lpRootPathName _
As String, ByVal pVolumeNameBuffer As String, ByVal _
nVolumeNameSize As Long, lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, lpFileSystemFlags As _
Long, ByVal lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long)
Const MAX_FILENAME_LEN = 256
Form code
Option Explicit
Private Sub Command1_Click()
Label1.Caption = SerNum('C') 'C is the standard harddisk