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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Protect Database

Status
Not open for further replies.

PercyN

Programmer
May 16, 2007
86
Hi,
Does anyone know how to lookup a computer's physical/mac address from VBA. I need to make sure that once my program is installed and registered, the database cannot be copied and used on another computer. Or is there any other way I can prevent my program from being illegally copied from one computer to another.
 
Function getMACaddress()
Dim objShell
Dim objExecObject, strText, searchstring1, searchstring2, position1, position2
Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("%comspec% /c nbtstat -a " & Environ("Computername"))
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadAll()
searchstring1 = "MAC Address ="
position1 = InStr(1, strText, searchstring1, 0) + 13
getMACaddress = Mid(strText, position1, 18)
Loop
End Function
 
Super! It works well.

Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top