Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: Code to read machine id

    Hi,

    I have created and forwarded a PC based db for my client. Following is the setup of my db:

    1. ShiftByPassKey method applied to protect the db from getting in by the unauthorized person.

    2. The db is in form of mdb file

    3. All are linked tables connecting from another MDB files (BE) which are simply password protected.

    4. The FE & BE both are kept in a folder called ‘software’ and placed on D:\ drive.

    I do usually update (if any) db and send only mde file in zip mode to the client by email. So once he receives, he copies the mde to the path (D:\software\filename.mde) and it runs well.

    My client is smart enough. He is just copying the entire db folder and placing it to the same kind of path of another pc and it works well as if it created for that pc. Like this he is using my db at many pcs without my information. I want him to stop doing so.

    Hence I am looking for some code snippets that would first read the machine id and open the db file if find value true otherwise exit with warning.

    Does anyone of you have any code to perform this task?

    With kind regards,

    Ashfaque

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Use an API e.g. http://www.vbcity.com/forums/faq.asp...cat=Networking (the very bottom FAQ entry).

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks Pootle,

    Do you mean the following code from the given site forum?

    Private Declare Function GetComputerName Lib "kernel32" Alias _
    "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    Function ComputerName() As String

    ' Returns the name of the local computer.
    Dim BUFFER As String * 512, Length As Long
    Length = Len(BUFFER)
    If GetComputerName(BUFFER, Length) Then
    ' this API returns non-zero if successful,
    ' and modifies the length argument
    ComputerName = Left(BUFFER, Length)
    End If

    End Function

    Also please let me know easiest way to use it.

    Regards,
    Ashfaque

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I have used the Computer Name (the code above) to validate users. If you create a User table and add the Computer Names that are allowable then that is a possible solution. When the Database opens check to see if the computer name is in the User table and show an appropriate message before quitting.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Just paste into a module. You can now get the username by (e.g.)
    Code:
    MyStringVariable = ComputerName()
    Quote Originally Posted by DCKunkle
    I have used the Computer Name (the code above) to validate users. If you create a User table and add the Computer Names that are allowable then that is a possible solution. When the Database opens check to see if the computer name is in the User table and show an appropriate message before quitting.
    You want to be sure that either your users are not duplicitious or you implement a heck of a lot of security if you store this info unencrypted in a table
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks again.

    I just placed a unbound text box on my main opening form and set its control source as =ComputerName(). When db opens it shows machine name. Fine.

    Can I use this trick into AutoExec Macro that runs just before loading the db? Or is there any other way to read ComputerName() before loading the db?

    Regards,
    Ashfaque

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •