Visual Basic .NET Forums    

Go Back   Visual Basic .NET Forums > Visual Studio .NET > Security/Obfuscation

VB.NET Forums Newsletter Signup:
Email address:


Security/Obfuscation Security related discussion pertaining to configuration, development, and deployment etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-05-2008, 6:51 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Sep 2008
Posts: 16
Reputation: 6
daveofgv is on a distinguished programming path ahead
Default Help on trial version

I have a set of code in a program that allows the user to access my program for only 15 days. If the user sets his/her date to a different date then the code is suppose to see it and send a message that the software has seen the date change. On the second time the user changes that date my program is suppose to end. However, for some reason, it is not seeing the date change when I manually change my date on my computer.

Here is the code....... Can anyone see why it will not see the date change? I am using visual studio 2008 pro.....


Code:
Public Class Form1

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

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim intTime As Integer = 1
        Dim dteLastStart, dteStartDate As Date
        Dim blnFirstTime, blnEnabled As Boolean
        Dim lngTimeLeft As Long

        blnEnabled = True
        If dteStartDate = Nothing Then
            dteStartDate = Now
        End If

        My.Application.SaveMySettingsOnExit = True

        If DateDiff(DateInterval.Day, dteLastStart, Now) < 0 Then
            'First clock change
            If intTime = 1 Then
                MsgBox("This software has detected that you have changed your system date to an earlier date" & vbCrLf _
                & "As this softwaer has built-in security," & vbCrLf _
                & "this software will only run until the next intTime you change your system date", _
                MsgBoxStyle.OkOnly Or MsgBoxStyle.Exclamation, "System Date Changed")
                intTime = 2
            ElseIf intTime = 2 Then
                'Second clock change
                blnEnabled = False
                MsgBox("This software has detected that you have changed your system date to an earlier date" & vbCrLf _
                & "As this is the second warning, this software will now be disabled", _
                MsgBoxStyle.OkOnly Or MsgBoxStyle.Exclamation, "System Date Changed")
            End If
            'disables app
            If blnEnabled = False Then
                If MsgBox("Software is disabled", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "Disabled") = MsgBoxResult.Ok Then
                    For Each form As Form In My.Application.OpenForms
                        form.Close()
                    Next
                End If
            End If
        End If
        If DateDiff(DateInterval.Day, dteStartDate, Now) > 15 Then
            blnEnabled = False
            If blnEnabled = False Then
                If MsgBox("This software has reached the end of it's trial.", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "Trial Ended") = MsgBoxResult.Ok Then
                    'Close all open forms
                    For Each form As Form In My.Application.OpenForms
                        form.Close()
                    Next
                End If
            End If
        End If
        dteLastStart = Now
        If blnFirstTime = True Then
            blnFirstTime = False
        End If
        'Saves variable settings
        My.Settings.Save()

        lngTimeLeft = 15 - (DateDiff(DateInterval.Day, dteStartDate, Now))

        MsgBox("This software is a trial version and can only be used for 15 days." _
        & "If you would like to purchase this software please contact DMB Software for the full version" & vbCrLf _
        & "You have " & CStr(lngTimeLeft) & " days left.", _
        MsgBoxStyle.OkOnly, "Software Trial")

    End Sub
End Class


Thank you in advanced for your help

daveofgv

Last edited by JohnH; 11-05-2008 at 8:04 PM. Reason: formatted post for readability
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 6:20 AM.




Click to advertise here

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
For advertising opportunities click here.