Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to add a layer of protection to my software where I can "hard code" each program sold with the serial number of or the free space in bytes available on the flash drive that I sell it on.

Being just a mug programmer using Visual Basic 2010 Express, but a knowledgeable engineer I am selling tutorials using "MS Forms" applications to students. My problem is that students are sharing my applications (copying my programs) with their whole class and reducing my sales.

I need help to write a complete project to get this information.

Thanking you all in anticipation. :-)

What I have tried:

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        


    Public Function GetDriveSerialNumber() As String
        Dim DriveSerial As Integer
        'Create a FileSystemObject object
        Dim fso As Object = CreateObject("Scripting.FileSystemObject")
        Dim Drv As Object = fso.GetDrive(fso.GetDriveName(Application.StartupPath))
        With Drv
            If .IsReady Then
                DriveSerial = .SerialNumber
            Else    '"Drive Not Ready!"
                DriveSerial = -1
            End If
        End With
        Return DriveSerial.ToString("X2")
    End Function

End Class
Posted
Updated 11-Mar-18 10:13am
v2
Comments
Dave Kreskowiak 9-Mar-18 16:05pm    
What makes you think every USB drive even has a serial number?
Chris.Crooks7 9-Mar-18 18:38pm    
I just thought that they would all have a serial number. If not, could you please tell me how to, perhaps, just get the available space on the USB drive as a "long". What I am looking for is a single form application that returns the integer value of available space into a text box.
Thanks for your comment :-)
Dave Kreskowiak 9-Mar-18 19:30pm    
Depends on the drive. The cheapo drives usually don't have a serial number. Most expensive one, like high capacity, encrypting drives, do.

As for disk space, that's easy --> DriveInfo.TotalFreeSpace Property (System.IO)[^]

 
Share this answer
 
You say you are "hard coding" each "program sold".

Then simply imbed the "purchaser's" name and / or email in your app, and "water mark" everything with the user's info.

Safari books did / does something similar.

You can probably automate the process; keeping "check sums" in mind if you plan to "patch" in your "id chips".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900