Consulting

Results 1 to 15 of 15

Thread: Solved: Generate a computer's hardware code

  1. #1
    VBAX Regular
    Joined
    Feb 2007
    Posts
    68
    Location

    Wink Solved: Generate a computer's hardware code

    How to Generate a computer's hardware based code to protect the workbook from copying ?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Do you mean

    [vba]

    Environ("ComputerName")
    [/vba]

  3. #3
    VBAX Regular
    Joined
    Feb 2007
    Posts
    68
    Location
    Hi,
    Thanks for your example, but I don?t want to get a computer?s name because it can easily changed, I want to generate a code based on the computer?s hardware or its CPU. (If you know , when we right click on My Computer Icon and select Properties option and then a window appears , you can find a code in it in the General Tab under the caption ?Registered To : xyz <code goes here> . I think that you know this. So, I want to use that code as my code and I want to insert it in A1 cell. ) Or any other idea, if anyone have?


    I have an attached a picture of software which uses that code. So, how to get it?
    Hope that you can understand the matter ?




    Link : http://www.excelshield.com/en/excelshield/tour3.htm

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Here is a way to get the disk volume id

    [vba]

    Function DiskVolumeId(Drive As String) As String
    Dim sTemp As String
    Dim iPos As Long
    iPos = InStr(1, Drive, ":")
    Drive = IIf(iPos > 0, Left(Drive, iPos), Drive & ":")
    sTemp = Hex(CreateObject("Scripting.FileSystemObject") _
    .Drives.Item(CStr(Drive)).SerialNumber)
    DiskVolumeId = Left(sTemp, 4) & "-" & Right(sTemp, 4)
    End Function
    [/vba]

    which you can get with

    diskvolumeid("C")

  5. #5
    VBAX Regular
    Joined
    Feb 2007
    Posts
    68
    Location
    hi xld,
    thanks ,......but any idea for any other code or id like any type of cpu code or any other ????

    Thanks for your example ,
    regards,
    dan

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Hi Dan,
    Still chasing your tail trying to make excel secure? You need to go to visual basic and create your app. Excel will never be secure the way you seem to want it to be.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    A volume id is an id like a cpu type.

  8. #8
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    What if they don't have a c:
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  9. #9
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    I think you are wasting your time (and are more likely to alienate paying customers than anything else) but the product ID you mention is in the registry at HKLM\Software\Microsoft\Windows\CurrentVersion\ProductId
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  10. #10
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Steve - I don't think you can not have a C:, can you?
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  11. #11
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    You wouldn't think so would you but yes you can not have a c.... I don't have one. I have a 300 gig exteral that when I turn it on becomes my C: but system is on F: and it works fine.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  12. #12
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Sigh... If you mean so the workbook will only open on one PC for one user, see here (but you're still wasting time - all these things are so easy to get round if you know how )
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  13. #13
    VBAX Regular
    Joined
    Feb 2007
    Posts
    68
    Location
    Hi ,
    The problem is around the "C" then why not use this :
    diskvolumeid(Environ("SystemDrive"))

    where Environ("SystemDrive") returns C; or d or the disk where the windows is loacted ...

  14. #14
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by dansam
    Hi ,
    The problem is around the "C" then why not use this :
    diskvolumeid(Environ("SystemDrive"))

    where Environ("SystemDrive") returns C; or d or the disk where the windows is loacted ...
    You're arguing against yourself now!

  15. #15
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Quote Originally Posted by xld
    You're arguing against yourself now!
    That would make him one up on Zack.

    Zack argues to argue, but not with himself.
    Brandtrock




Posting Permissions

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