Virtual Developer Workshop: Containerized Development with Docker

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:
     CRegDialog regDlg;
    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";


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.


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


  • Shareware Registration Services Comparison

    Posted by Regsw on 10/11/2006 06:24am

    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.

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

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

    Originally posted by: SaDJ0KeR

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

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

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

    Originally posted by: dave


    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.

  • Effective but simple

    Posted by Legacy on 10/24/2002 07: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.



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

    Originally posted by: KAPPA


  • You must have javascript enabled in order to post comments.

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

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date