Hello all. I have seen this code before on here and searched everything but could not find it. I have the program to send to the user where it will create the key. The key is their hard drive number. They Will send it back to me so I know what it is then add it into my project so at start up it will only load for the people that have hard drive serial numbers of which are listed. If it is not there then it will not load for them. So i am just looking for code or an example or help of it to show me how I can have it load up for only certain hard drive numbers and not for others? Well thanks in advance guys for all the help and it is much appreciated. Have a good one Peace
Thank you all. Yes I know there a re progs out there but I don't really care that much for the people going to be using it. So as snorky posted:
Option Explicit
Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (_
ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String,_
ByVal nVolumeNameSize As Long, ByRef lpVolumeSerialNumber As Long, _
ByRef lpMaximumComponentLength As Long, ByRef lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
'Get the MachineID (C-drive serial number)
Public Function MachineID() As String
Dim lSerialNum As Long
Call GetVolumeInformation("C:", vbNullString, 0, lSerialNum, 0, 0, vbNullString, 0)
MachineID = CStr(lSerialNum)
End Function
Sub Main()
If Not LicensedForPC() Then
Call MsgBox("Not licensed for this machine", vbOKOnly)
Exit Sub
End If
frmMain.Show
End Sub
Public Function LicensedForPC() As Boolean
Select Case MachineID()
Case "12345678", "11111111", "22222222", 'etc
LicensedForPC = True
Case Else
LicensedForPC = False
End Select
End Function
I have all that which I think wil ldo the trick jsut cant arrange it all right to do it correctly. I am trying to have it on form load so if it finds the hard drive number it will continue loading if not it will unload. The number will be in the code. So I am asking for all the help I can get and it is much appreciated. Once again thank you all and plz try and help a n00b out Peace