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

Limit Use on certain Desktops

Status
Not open for further replies.

Affy

Programmer
Nov 27, 2001
9
GB
Anyone know how i can limit the use of my Access database so it only works on one desktop, so if someone were to make a copy it would not work on any other desktop.
 
I know there is an API to get the user name. You'd better search to find if there is one to get the computer name (must be).

Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpszLocalName As String, ByVal lpszUserName As String, lpcchBuffer As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: 'E-Mail: KPDTeam@Allapi.net
Dim lpUserName As String, lpnLength As Long, lResult As Long
'Create a buffer
lpUserName = String(256, Chr$(0))
'Get the network user
lResult = w32_WNetGetUser(vbNullString, lpUserName, 256)
If lResult = 0 Then
lpUserName = Left$(lpUserName, InStr(1, lpUserName, Chr$(0)) - 1)
MsgBox "The user's Network Logon Name is " + lpUserName + ".", vbInformation + vbOKOnly, App.Title
Else
MsgBox "No user found !", vbExclamation + vbOKOnly, App.Title
End If
End Sub


Patrick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top