Results 1 to 7 of 7

Thread: Demo application

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    chennai, Tamil Nadu, India.
    Posts
    84

    Demo application

    1. How to make my application to work only for 30 days i.e., as an demo application

    2. How to make my application to run only one instance?

    S.Desikan
    S.Desikan

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    good morning desi_in

    2. How to make my application to run only one instance?

    VB Code:
    1. Private Sub Form_Load()
    2.   If App.PrevInstance = True Then
    3.       AppActivate "AppName"
    4.       Unload Me
    5.   End If
    6. End Sub
    -= a peet post =-

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    here is a sample on how to protect your app. Its not the best protection, but it should get you started


    VB Code:
    1. Option Explicit
    2.  
    3. Public Function DateGood(NumDays As Integer) As Boolean
    4.     'The purpose of this module is to allow you to place a time
    5.     'limit on the unregistered use of your shareware application.
    6.     'This module can not be defeated by rolling back the system clock.
    7.     'Simply call the DateGood function when your application is first
    8.     'loading, passing it the number of days it can be used without
    9.     'registering.
    10.     '
    11.     'Ex: If DateGood(30)=False Then
    12.     ' CrippleApplication
    13.     ' End if
    14.     'Register Parameters:
    15.     ' CRD: Current Run Date
    16.     ' LRD: Last Run Date
    17.     ' FRD: First Run Date
    18.  
    19.     Dim TmpCRD As Date
    20.     Dim TmpLRD As Date
    21.     Dim TmpFRD As Date
    22.  
    23.     TmpCRD = Format(Now, "m/d/yy")
    24.     TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000")
    25.     TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000")
    26.     DateGood = False
    27.  
    28.     'If this is the applications first load, write initial settings
    29.     'to the register
    30.     If TmpLRD = "1/1/2000" Then
    31.         SaveSetting App.EXEName, "Param", "LRD", TmpCRD
    32.         SaveSetting App.EXEName, "Param", "FRD", TmpCRD
    33.     End If
    34.     'Read LRD and FRD from register
    35.     TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000")
    36.     TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000")
    37.  
    38.     If TmpFRD > TmpCRD Then 'System clock rolled back
    39.         DateGood = False
    40.     ElseIf Now > DateAdd("d", NumDays, TmpFRD) Then 'Expiration expired
    41.         DateGood = False
    42.     ElseIf TmpCRD > TmpLRD Then 'Everything OK write New LRD date
    43.         SaveSetting App.EXEName, "Param", "LRD", TmpCRD
    44.         DateGood = True
    45.     ElseIf TmpCRD = Format(TmpLRD, "m/d/yy") Then
    46.         DateGood = True
    47.     Else
    48.         DateGood = False
    49.     End If
    50. End Function
    51.  
    52.  
    53. 'Usage
    54.  
    55.  Private Sub Form_Activate()
    56.     If Not DateGood(30) Then
    57.         MsgBox "Trial Period Expired!", vbExclamation, "Unregistered application"
    58.         Unload Me
    59.     End If
    60. End Sub
    -= a peet post =-

  4. #4
    Member
    Join Date
    Dec 2004
    Posts
    56

    Re: Demo application

    Ok.. correct me if I wrong. But, I tried this code.. and then went into my registry... HKEY_CURRENT_USER\Software\VB and VBA Program Settings, and I find the program name with FRD and LRD (First Run Date, Last Run Date) sitting right there.. with the actual dates in them. So.. using this method, wouldn't one just have to change the date to beat this code? I've never done any registry work.. so I'm just trying to understand it.
    Thx all!

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Demo application

    I would encrypt the dates, and make the reg keys names a bit more obscure. You could also use the registry APIs to store the info in different place in the registry.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Demo application

    Quote Originally Posted by jolene_keagy
    .... wouldn't one just have to change the date to beat this code?
    No doubt. As peet mentioned its a demo and not the best protection. However, I't
    may give you a place to start. What you can now do is use some 'encryption' alorithim
    to save out the date and decoded when read back in for validation.




    Bruce.

  7. #7
    Member
    Join Date
    Dec 2004
    Posts
    56

    Resolved Re: Demo application

    thx all!
    Jolene

Posting Permissions

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



Click Here to Expand Forum to Full Width