Any ideas on how to construct a vb program to only work on a specific computer ? Perhaps reading some kind of s/n, maybe hardrive or cpu ? How can I accomplish this task ?
The thing about doing based on the cpu or the hard drive or a s/n means that if those components get swapped out of the machine the program will stop working. Maybe you could base it on the nt login.
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
Public Function DriveSerialNumber(ByVal Drive As String) As Long
Dim lAns As Long
Dim lRet As Long
Dim sVolumeName As String, sDriveType As String
Dim sDrive As String
sDrive = Drive
If Len(sDrive) = 1 Then
sDrive = sDrive & ":\"
ElseIf Len(sDrive) = 2 And Right(sDrive, 1) = ":" Then
sDrive = sDrive & "\"
End If
sVolumeName = String$(255, Chr$(0))
sDriveType = String$(255, Chr$(0))
lRet = GetVolumeInformation(sDrive, sVolumeName, _
255, lAns, 0, 0, sDriveType, 255)
DriveSerialNumber = lAns
End Function
Did you do a search on the forum for 'MAC'? (or for any of the others)
It turned up several for me, including thread222-486768
Read faq222-2244 to get the best from the forum
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.