Retrieve The Hard Disk (partition) Serial Number

Category:
System/API
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6

More information:
This function utilizes the Microsoft Scripting Runtime library to retrieve the serial number of the local hard drive. This serial number is generated by Windows (or DOS) when you format a disk partition. Simply add a project reference to this runtime library and run the code. There is a form_load event handler that uses msgBox() to display the results.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: