Re: Computer Name - Best way to obtain this VB.Net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks for all of the feedback on this and my recent posts. I have decided
to go with computer name and to use this along with other strings in an
encrypted format to produce my registartion keys. This will be more than
adequate for my purposes, as I do not want to make life difficult ofr my
users, but just want to preevent them from making multpile unpaid installs
on the same network.

Best wishes,


Paul Bromley



"Pritcham" <dontwanttogivemyname@xxxxxxxxxxx> wrote in message
news:1165841082.577163.65320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Paul

You could also use the MAC address as this is specific to the NIC card
(as far as I understand) and has to be unique on the same network.

As a failsafe to the code that's posted here for getting the serial
number of the harddrive, you could use a combination of the MAC address
and the harddrive serial - that way, if the drive doesn't have a serial
then you can use the MAC address.

There's plenty of code available for getting the MAC address should you
need it.

Martin

Paul Bromley wrote:

Many thanks for this Shane - I will take a look tomorrow. Has this worked
OK
on Win2K as well as XP?

Best wishes

Paul Bromley


"ShaneO" <spcacc@xxxxxxxxxxxxxxx> wrote in message
news:457c99ff$0$16557$afc38c87@xxxxxxxxxxxxxxxxxxxxxxx
Paul Bromley wrote:
I assume that this is likely to be the best way? :-

mComputerNetBiosName = System.Environment.MachineName


Yes, you're correct with this.

I've followed your other posts and would like to suggest that
generating a
unique Serial Number for your software, on each machine that it is
executed, is not that difficult.

I use the following code (watch for wrapping!) -

Imports System.Management

''' <summary>
''' String of 1 to 2 chars. eg. "C" or "C:".
''' </summary>
''' <param name="sDriveLetter"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As
String

If Len(sDriveLetter) = 1 Then
sDriveLetter &= ":"
Else
sDriveLetter = Strings.Left(Environment.SystemDirectory, 2)
End If

Dim HardDiskInfo As New ManagementObject("Win32_LogicalDisk.DeviceID="
&
ChrW(34) & sDriveLetter & ChrW(34))
Dim HardDiskProperty As PropertyData =
HardDiskInfo.Properties("VolumeSerialNumber")
Return HardDiskProperty.Value.ToString

End Function


I first obtain the Drive Serial Number and then ensure it is
8-Characters
in length -

Dim sA As String =
GetDriveSerialNumber(Strings.Left(Environment.SystemDirectory, 2))

Dim N As UInt16 = Len(sA)
If N < 8 Then
sA = sA.PadRight(8 - N, "0")
ElseIf N > 8 Then
sA = Strings.Left(sA, 8) 'Truncate to 8 Chars.
End If


After this I "AND" the value with another routine that automatically
generates an 8-Character HEX number based on the title of my software.
I
then end up with a 16-Character HEX number, which is unique to each of
my
applications and unique on every computer, I then do some more XOR'ing
and
present this to the User as the Application Serial Number.

I obviously have another application that reverses all of this to
provide
an Unlock Code that the User enters.

There are literally hundreds of Users running my applications using
this
method, and although it really only stops the honest pirates, it serves
my
purposes well.

If you'd like to see an example, please download one of my apps
(written
for specific clients) from the following site -

www.arnfieldcomputerservices.com/apps/spi/publish.htm

This will provide an example of what my Registration Screen looks like.

If you require any further assistance, please feel free to contact me
direct via the email address used in this post.

ShaneO

There are 10 kinds of people - Those who understand Binary and those
who
don't.



.



Relevant Pages

  • Re: code to move files created between two dates to folder B?
    ... Have fun with your new Mac. ... Dim oFSO As Scripting.FileSystemObject ... Dim StartDate As String ... Private Declare Function GetExitCodeProcess Lib "kernel32" (_ ...
    (microsoft.public.word.vba.general)
  • MAC Retrieval
    ... Hi everybody - Ive been looking for some vba to lookup the MAC address ... Dim oColAdapters As Object ... ncb_callname As String * NCBNAMSZ ... Public Declare Function GetProcessHeap Lib "kernel32" As Long ...
    (microsoft.public.excel.misc)
  • Re: Help with Macro Using InStrRev: How to Rewrite to Use on Macs
    ... I appended the code you provided and now the macro works ... the PC and Mac versions of XL were fully compatible with each other, ... Dim sFormula As String ... Dim sWDFormula1 As String ...
    (microsoft.public.excel.misc)
  • Re: Computer Name - Best way to obtain this VB.Net
    ... You could also use the MAC address as this is specific to the NIC card ... Public Function GetDriveSerialNumber(ByVal sDriveLetter As String) As ... Dim HardDiskProperty As PropertyData = ... There are literally hundreds of Users running my applications using this ...
    (microsoft.public.dotnet.languages.vb)
  • Re: VS2005 vs VS2003 Web Service Calls - The underlying connection was closed: An unexpected err
    ... I have applied all the fixes that were specified in other posts, ... Private Function PostWithResponse(ByVal URL As String, ... Dim Response As HttpWebResponse ...
    (microsoft.public.dotnet.framework.webservices)