Frequently asked questions
Answers to the most common questions about GetDiskSerial DLL and our other products.
Sample code
How do I read the hard disk serial number in a C# program?
Use the GetDiskSerial DLL. With a few function calls you can read the serial number of the hard disk in your C# project:
private void Command1_Click(object sender, System.EventArgs e)
{
HDiskInfo.SetLicenseKey("Your-License-Key");
textBox1.Text = HDiskInfo.GetSerialNumber(0);
textBox2.Text = HDiskInfo.GetModelNumber(0);
}
How do I read the hard disk serial number in a VB.NET program?
Use the GetDiskSerial DLL in your VB.NET project:
Private Sub Command1_Click(sender As Object, e As EventArgs) Handles Command1.Click
SetLicenseKey("Your-License-Key")
Text1.Text = GetSerialNumber(0)
Text2.Text = GetModelNumber(0)
End Sub
How do I read the hard disk serial number in a Visual Basic program?
Declare the DLL functions and call them from your VB 6 project:
Public Declare Sub SetLicenseKey Lib "GetDiskSerial.dll" (ByVal RegCode As String)
Public Declare Function GetSerialNumber Lib "GetDiskSerial.dll" (ByVal DriveIndex As Byte) As String
Private Sub Command1_Click()
SetLicenseKey("Your-License-Key")
Text1.Text = GetSerialNumber(0)
End Sub
How do I read the hard disk serial number in a Delphi project?
Call the DLL functions from Delphi:
procedure TForm1.Button1Click(Sender: TObject);
begin
SetLicenseKey('Your-License-Key');
Edit1.Text := GetSerialNumber(0); // serial number
Edit2.Text := GetModelNumber(0); // model number
end;
Prefer a native component instead? See TGetDiskSerial VCL.
Licensing
How do I remove the nag window in the GetDiskSerial DLL trial?
The nag window appears in the trial version. Once you purchase a license, a registration number is sent to you by email — call SetLicenseKey() with that key to remove the trial limitation.
Which languages does GetDiskSerial DLL support?
GetDiskSerial DLL is a standard Windows Dynamic Link Library usable from C#, VB.NET, Visual C++, Visual Basic, Delphi, C++ Builder, PowerBuilder, Visual FoxPro, MS-Excel, MS-Access and Clarion. Example projects are included in the folder {installed-folder}/GetDiskSerial DLL/example/.