Creating a Shareware Registration Dialog Box

Environment: VC++ 6.0, W2000

RegDialog is the MFC-based dialog that will help you to manage shareware applications' registration.

When the shareware application is started for the first time, information about the company, applicant's name, version number, trial period, and starting date is created in the Registry. Every following time the user starts the application, RegDialog appears with information about the number of days left to use and offers registration code entering or to continue unregistered.

After the trial period is finished, the user can only enter the registration code and after the shareware application is registered, RegDialog will no longer appear. Of course, the user can register the application during the trial period, also. Reinstalling the shareware application will not "help" because the information about the starting date is left in the Registry and the "new" application will just continue to count the trial period days. The first time the user starts the shareware application, RegDialog will not appear; that is because the user should first see and test the application. That time, I think, is not the right time to send him messages about days left to use or about continuing unregistered. So keep this in mind when you start the demo application or your application with RegDialog—REGDIALOG WILL SHOW WHEN YOU START YOUR APPLICATION THE SECOND TIME! Also, because RegDialog is working with SYSTEMS REGISTRY, please see the NOTE below.

How to Use It

  1. Create or open your existing code.
  2. In the VC++ menu, select Project->Add to Project->Components and Controls...
  3. Browse to RegDialog.ogx (downloaded in RegDialog_ogx.zip) and select it.
  4. In the application's main class, insert #include "RegDialog.h".
  5. In the same class, in the InitInstance() function, insert:
    ...
     SetRegistryKey(_T("MyCompany"));
     CRegDialog regDlg;
     regDlg.Check();
    ...
    
    Of course, replace "MyCompany" with something you choose or have as an adequate name.
  6. In RegDialog.cpp, modify the part specified as "App specific data":
  7. /////////////////      App Specific Data !!!  ////////////
    
    int DaysLimit = 30;
    long KeyCode  = 12345678;
    CString Version = "1.1";
    /////////////////////////////////////////////////////////
    

where:

DaysLimit is the number of days application will work unregistered.

KeyCode is the code that user must enter to register application.

Version is a string used to avoid that newer versions of your software are all registered if older version was.

All this you can see in the demo project you can download from this page (RegDialog_demo.zip).

Here are a few things you need to know:

The OnAskcode() function of the CRegDialog class is the place you should put what will happen when the user clicked the "Register" button. It can be some dialog with the price and a hyperlink to registration site, some register.exe file, or a "send mail" link.

KeyCode is a long type variable. If you need KeyCode with letters included, modify the code so it writes string types instead of int types to the Registry database (see the NOTE below!).

The code can be easily modified to calculate the user's registration code from letters of his name instead of using the KeyCode variable compiled in the application.

NOTE: Because this class is working with the system's Registry—the important OS database—be careful if you change the code. If you don't know exactly what the Registry functions are doing, do not change them! Just use the class as it is and it will work. See MSDN for information and help about the Registry system.

Downloads

Download demo project - 44 Kb
Download ogx source - 5 Kb
Download single executable - 6 Kb



Comments

  • Shareware Registration Services Comparison

    Posted by Regsw on 10/10/2006 11:24pm

    I have a small site where is intended as an aid for shareware authors to compare and select the most appropriate shareware registration services. The list are the processing and other associated fees for each shareware registration service. Those information was gathered from the website of each shareware registration service. If you know of a service which should be listed but isn't, please contact them and mention this page. I will be happy to add more entries, if given sufficient details to complete the items below. Please go to: www.regsw.com.

    Reply
  • good ... but it`s easy for cracking.

    Posted by Legacy on 03/08/2003 12:00am

    Originally posted by: SaDJ0KeR

    awesome ... but it`s easy for cracking. work :)
    

    Reply
  • Ok as a starting point, but no good for real world ...

    Posted by Legacy on 10/25/2002 12:00am

    Originally posted by: dave

    Hi,

    Your project is interesting as a starting point for a registration process, but it's a little too uncomplicated to use in real shareware.

    Firstly, you can't store this information in the registry, certainly not without encrypting it. If a user can change the information and extend their registration period, your software may never get registered.

    Secondly, you need to not only store the date the software was installed, but also the dtae it was last run. At the moment, if i set my clock back to the day before i installed it, your dialog tells me i have 31 days left ! If i set it back a week, then i have 37 days !

    To be effective, the application needs to check that the system date is always later than the last time it was run. If not, then the user has set the clock back, and you tell them the demo has expired.

    It is also not advisable to have all your eggs in one basket, you should not store all the registration information in the same place. What i do is to generate a uuid the very first time the software is run, i then write that uuid as part of the registration information (date installed, date last ran, date it will expire), encrypt it and store it somewhere. I then also store the uuid again somewhere else.

    Upon starting the application, you look for the uuid. If it doesn't exist, then the application has never been run before so you generate the registration information (you calculate the dates at this point and then generate the uuid). If the uuid does exist, then you check that it matches the uuid in the registration information. If it doesn't, then you say the demo has expired. You then check the dates - only if the date is after the date it was last run and before the date it expires do you allow it to run in demo mode. Otherwise it has expired.

    I know it seems complicated when compared to the simple algorithm you are using, but then if it isn't, you may lose out on registrations. And if you've spent a lot of time on your application, then you should put a similar amount of effort into your protection routines.

    Reply
  • Effective but simple

    Posted by Legacy on 10/24/2002 12:00am

    Originally posted by: TheVoodoo

    Although this example is fairly indicative of the way some companies choose to authorize their applications, it is still very simple and very easy to bypass. For example, you could simply change a little bit of program code to alter the number or find the number because there is no encryption level, it is all stored in the registry so you can simply change the key, you could use decompile the exe to assembler and add one single jmp code. This is a good starting point to use, but please do not take this seriously to use in a legitimate product, there are too many holes. Other than that it is a very good introductory point because alot of companies still use this, very dated, approach.

    -TheVoodoo

    Reply
  • EXACTLY WHAT I'M LOOKING FOR

    Posted by Legacy on 10/24/2002 12:00am

    Originally posted by: KAPPA

    THANKS!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: October 23, 2014 Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this webcast to learn why physical appliances are preferable to virtual backup appliances, …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds