Give users a fully functional demo of your application!

by Jake Vuckovic


Jake Vuckovic is an Alpha Five developer in Mississauga, Ontario. Jake is very much engaged with working papers software for accounting professionals. He intends to distribute his application, Engage!, via the web.
You can reach Jake at teslaac@netscape.net

I have been working on this application for about five months, which is, by the way, the same length of time I have been programming. Alpha Five is that easy!
My app will be available for download as a fully functional demo, with some restrictions, and once the user decides to pay for it, they get the registration number, and those restrictions are removed.

I have come up with such a simple scheme, that I said to myself: "This is so simple, it can't be that easy, I will ask Dr. Wayne for his opinion." Well, if you are reading this on Dr. Wayne's website, I guess he must have liked it.

First, take any binary file, small, up to 10K. Don't use a file that has 'version' information in 'Properties'. I would not use a text file either, because people tend to open them with text editor. If they open binary file, they will see bunch of gibberish. I decided to name this file A5dmfc.dll (sounds like a legitimate A5 dll). You can use any other name, but make sure that it will not be confused with any of the files in the Alpha Five directory. The reason I chose a .dll extension is that most people won't touch a .dll file, let alone delete it!
Whatever you are using to create your setup, make sure that this file is included and installed in the %maindir, or %installdir or whatever they call it in your setup program. Ideally, this file should be installed in the windows\system directory, but I could not get the API (GetSystemDirectory@GetSystemDirectoryA) to work in A5.

Editor's note: If you are developing an application for sale to others, you will also be interested in 2 other articles:

My little scheme tests for the existence of a control file (ct_file), and if the file is found, prompts the user for registration. It also creates a global variable, registered, which can be used throughout the program to limit certain functions. Not disable, remember, we want to give them a fully functional demo.
I have placed this global variable on all my reports. Since the main purpose of my app is to generate reports, the app is of little value without reports. Of course, I have password protected all the reports and scripts. You can do the same for forms.

Once the user enters the correct registration number, the control file is deleted, and the global variable registered is set to "". In case the file cannot be deleted, I have placed an error handler, and the global variable is set to "UNREGISTERED DEMO SOFTWARE..." .

Myform

Fig. 1 – Report

The code


I used an autoexec script to greet the user with "Register" form.
Note:
If you have a form designated as the startup form, you must disable it and load it from an autoexec script instead. You should also declare registered as global anywhere you intend to use it: forms, reports etc.
Most of us will have a dummy table, and this form is based on it.


Myform    Myform

Fig. 2 – Register form

The form has one field, reg_yes, which is a global variable. The text is a Rich text object with an embedded bitmap.

autoexec script:

''XBasic
dim global registered as C
dim ct_file as C
dim global reg_no as C
dim global reg_yes as C
reg_no = "I love Alpha Five" 
'well, you make this anything you want
registered = "***UNREGISTERED DEMO SOFTWARE. PLEASE REGISTER.***" 
m_path = A5.get_exe_path()
ct_file = m_path + "\a5dmfc.dll"
result = file.exists(ct_file)
IF result = .T. THEN 
	'control file found, prompt the user to register
    form.load("Register","dialog")
    :Register.activate()
    :Register.show()
    :Register.close()
    ON ERROR GOTO error_handler
    if reg_yes = reg_no then 
	'check if user entered correct registration number
        file.remove(ct_file) 
	'if correct, remove control file and set var->registered = ""
        registered = ""
    else
        registered = "***UNREGISTERED DEMO SOFTWARE. PLEASE REGISTER.***" 
    end if
    :Form.view("Your startup form")
    cancel()
    end
ELSEIF result = .F. then 
	'control file not found, set var->registered = ""
    registered = ""
    :Form.view("Your startup form")
    cancel()
    end
END IF
error_handler:
ui_msg_box("Error",\
"Unable to register. Please read online help for more info.",\
ui_attention_symbol)
registered = "***UNREGISTERED DEMO SOFTWARE. PLEASE REGISTER.***" 
:Form.view("Your startup form")
END

"Register Later" button simply closes the form
"Register Now" button has a simple script:

if reg_yes = reg_no then
   parentform.close()
else
   ui_msg_box("Registration","Invalid registration number!",\
	ui_attention_symbol)
   reg_yes.activate()
   cancel()
   end
end if

You could use this scheme to limit the number of records user can save before registering. Put this on a form's CanSave event, or on a table's CanSaveRecord event, to limit records to 10:

dim global registered as C
tbl = table.current()
rec_count = tbl.records_get()
if rec_count = 10 .AND. registered <> "" then
   cancel() 'if used on a table's CanSaveRecord event
   ui_msg_box("Sorry","You cannot save any more records. Please register.",ui_attention_symbol)
   this.cancel() 'if used on a form's CanSave event
end if
end

1/1/00

Don't forget, we need your feedback to make this site better!

Return to home