Click to See Complete Forum and Search --> : Reading a Unique System ID


rasutton
August 19th, 2001, 03:57 PM
I have a requirement to read/get a a unique ID from a computer that some software I wrote will run on. I figured either getting the Windows OEM#, CD Key, or the Processor/chip number are good methods but I'm not sure where to start on this one.

Any help/code example would be great! I'm fairly new to VB client programming. Thanks in advance for you help.

Rob

Iouri
August 20th, 2001, 07:10 AM
You can read the hard drive serial number

Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long



Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim strTmp As String
Dim strTmp2 As String
strTmp = String$(255, Chr$(0))
strTmp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, strTmp, _
Len(strTmp), SerialNum, 0, 0, strTmp2, Len(strTmp2))
GetSerialNumber = SerialNum
End Function





Private Sub Command1_Click()
Me.Caption = GetSerialNumber("C:\")
End Sub




Iouri Boutchkine
iouri@hotsheet.com