Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

computer specific application

Status
Not open for further replies.

bigfigkid

Programmer
Feb 18, 2003
26
CA
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 ?

thanks in advance for your time
 
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.
 
You're right. But out of curiousity, what commands would I use in vb to retrieve the following :

modem MAC address
cpu s/n or HD s/n

thanks
 
This will get you the HD S/N:


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.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top