I don't even know what a dongle system is.... but I will say that going about protecting your program from piracy is going to be a difficult task. There have been hundreds of attempts, most of which fail. You can make it secure from the majority of users, who "don't know", but for a lot of people, piracy is a skill that they are going to keep practicing.
There is a way to create a thirty-day free trial (if that interests you). This hard codes the license key code into each copy of the application (you have to compile multiple times in order to give it to multiple users if you do not want them to share codes).
This code (below) is from a real application I wrote - in VB-6. I hope this helps you.
' Component : frmRegCode
' Project : NewNotes
' Description: [a form to register the Notepad for permanent use]
' Modified : 4/8/2005
Dim strFirstRun As String, lngDaysRun As Long, strRegCode As String, _
strValidCode As String, strUser As String
Private Sub cmdSubmit_Click()
Rem: validate the registration code, save the code to the registry
strValidCode = "test code"
strRegCode = txtRegCode.Text
If strRegCode = strValidCode Then
lblWarning.Visible = False
Call VBA.SaveSetting(App.EXEName, "Copyright", "RegCode", strRegCode)
Me.Visible = False
frmNote.mnuHelpRegister.Enabled = False
lblWarning.ForeColor = vbRed
lblWarning.Caption = "Warning: Invalid Registration Code" & vbCrLf
lblWarning.Caption = lblWarning.Caption & "Please e-mail email@example.com"
lblWarning.Caption = lblWarning.Caption & vbCrLf & "to obtain a validated code"
lblWarning.Visible = True
Private Sub Form_Load()
strRegCode = VBA.GetSetting(App.EXEName, "Copyright", "RegCode", "")
strUser = VBA.GetSetting(App.EXEName, "Copyright", "UserID", "")
Rem: If the reg code is blank or invalid...
strFirstRun = VBA.GetSetting(App.EXEName, "Copyright", "strfirstrun", .Date$)
lngDaysRun = VBA.DateDiff("d", strFirstRun, VBA.Date$)
If (lngDaysRun > 30) Then
strRegCode = txtRegCode
Me.cmdSubmit.Enabled = False
Private Sub txtName_LostFocus()
Private Sub txtName_Validate(Cancel As Boolean)
txtName = Trim$(txtName)
If IsNull(txtName) Then
Cancel = True
Cancel = False
If Cancel = True Then
txtName.BackColor = vbRed
lblName.ForeColor = vbRed
txtName.BackColor = vbWhite
lblName.ForeColor = vbBlack
Private Sub txtRegCode_Validate(Cancel As Boolean)
txtRegCode = Trim$(txtRegCode)
If Not IsNull(txtRegCode.Text) Then
Cancel = False
Else: Cancel = True
cmdSubmit.Enabled = Not Cancel