	          


                               **Read this prior to starting, it is IMPRORTANT**	
                                (It's a real good idea to print it out before proceeding)

                                             RegistryAddInTools - Instructions

CAUTON:  Working in / with the Windows Registry can be dangerous to your 
                    operating system and result in rendering your computer inoperable. 
                    I have thoroughly tested these programs on a couple of computers 
                    operating with Windows 98 and Windows 2000.  I have not had any 
                    difficulties.  "THESE PROGRAMS HAVE NOT BEEN TESTED 
                    ON WINDOWS XP OR WINDOWS NT" any version. 

	  Having said that,  it would be wise to backup the registry files
	  (System.dat and User.dat) before performing any type of modifications. 
                    In addition, it would be worthwhile to read and print the "Restore the Registry" 
	  Help Topic found in the RegEdit Program.  If you follow the instructions given
	  here you should not have any problems.  Just "Stick to the Script" as it were, and
                    follow each step in order, don't  jump ahead .
                           
                       The Registry Add-In Tools are made up of two zip files.

		1.  RegistryAddInDLL.zip
		2.  RegisterSoftware.zip

"RegisteryAddInDLL" is a Visual Basic 6.0  Add-In Project.  "RegisterSoftware" is a
 program to test the Windows Registry Settings and use a  Program Registration sequence
 in your own applications.  

Both projects are commented quite thoroughly and those experienced with 
manipulating the Windows Registry should have no trouble figuring things out. 

Create two subfolders in your main VB directory, name them
                "RegisterSoftware" and "RegistryAddInDLL".
Unzip the respective zip files into the appropriate subfolder.

Compile the DLL, go to the Add-Ins Menu, select "Add-Ins Manager
select the "Registry Settings Tool" and check the appropriate "Load Behavior"
check boxes (Loaded/Unloaded and Load on Startup) .  

Close this dialog and you will see a Registry Icon on the Standard VB toolbar, it 
should be the last icon on the bar.   Hover the mouse over it and it will display it's
tool tip ("Registry Settings Tool").  From here on out it is available to you. 

Close this Program and open a new VB EXE project, select "New Standard EXE", a new
project opens with Form1 displayed.  Double click on the Form1 to expose it's code window.  Next move the mouse cursor just above the Forms Load statement

 	            Option Explicit
                        {set cursor position here}
                         Private Sub Form_Load()

left click to set the cursor position here.  Click on the Registry Settings Tool Icon on the 
VB Standard Tool Bar and fill  in the data, for now use the following;

    Leave the Default Root Key set to HKEY_CURRENT_USER
    Enter  "AAMyCompany" in the  Main Key Text Box
    Enter "MyApplication" in the Application Sub Key Text Box
    Enter your own name in the "Your Name" Text Box
    Select the "Set for Shareware" option

NB!  selecting the "Run On Windows Start Up" should be left UNCHECKED at this point. 

Click on the Generate Code command button.  Next select the "Minimize me to Paste" 
checkbox. (The Add-In is minimized to the Windows Task bar) and your back at the new
Project's Form Code window. 

Make sure the cursor is still set above the Private Sub Form_Load() statement, if it's
not, set it there.  Right click the mouse and select "Paste" from the popup menu. The code
is inserted.  You can scroll down to the end and eliminate the redundant 

	Public Sub Form_Load()

	End Sub

or you can just leave it be, VB will automatically eliminate it when the Project is run.
 
Run your new project, nothing happens, but bring back the Registry Settings Tool 
(it's flashing on the Windows Taskbar).  Click on "Display Registry Settings", which will 
"Shell" to the "Windows RegEdit" program. Now drill down the Windows Registry  to:

"HKEY_CURRENT_USER\Software\Whatever Main Key you chose\Your Apps Name" 

the following String Values have been entered;

		[Default]                       [value not set]          
		Expiration Date            (30 days from current date)
		Installation Date           (current date)
		PrgmSet                       ""
                                    Program By:                 "Your Name"
                                    Registration Number     ""
                                    User Name                   ""

Once you are satisfied that the entries have been made, you can close the RegEdit program,
 suspend the execution of your new project, minimize it, and use the Add-In to test the 
"Delete Keys" command Button, redisplay the RegEdit Program and see that your Main Key 
and it's entries have been deleted.  You can click the "Save to Registry" command button, 
check the Registry with "Display Registry" and see that the values have been re-entered. 

If you maximize the new Project and run it again, you will just write over the existing entries.

A word about the "Set to Run on Windows Start Up" option, selecting this option enters

"HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run",_
 "Your App",  "C:\Program Files\" & "Your App" & ".exe"

to the Windows Registry.  This of course will cause "Your App" to run on Windows Start.  
It is set to locate "Your App" in the "C\Program Files" directory.  (You can modify this to 
any directory that you wish to deploy your application to).  Remember that this is a feature
 that is rarely used so be careful employing it. 

When you invoke this feature and select the "Save to Registry" command button the value is 
set in the Registry, you can verify this by selecting the "Display Registry" command prior to 
selecting the "Delete Keys" command.  When "Delete Keys" is selected on the Add-In this 
entry is removed, remember however, that if it has been pasted into a project and has been 
run, this key value is still set. 

After you are familiarized with the Add-In, you can close all VB windows and go on to the 
"Register Software" program.  It is straight forward and well documented, you should have 
no trouble navigating it.  

Ok, time to check things out.  Close out all VB Projects and load the "Register Software" 
program.  Since the "Registry Settings" Add-In is available on the Standard Tool Bar you can 
select it and enter the values given previously.  You should use these values because the 
"Registry Software" Program is presently set with these settings.  


This project has three forms; 

			1.  frmCheckRegistration
			2.  frmProductRegistration
             		                  3.  frmTestApp

Run this project, do not change any of the Text Box Values just yet, you can do so
after testing but the values are presently set up to accomodate the existing settings that
were used above.   After familarization, you can change the MainKey and SubKey to
suit your applications, these values are found in the Form Load Events of each of the above
Forms..                        

Basically, this program checks the Windows registry for the applications settings and 
ascertains as to whether or not the application  has been registered.  If the "Set For
 Shareware" option was invoked when the Registry entries were made, it will check for the 
"Expiration Date" and see if the 30 day trial is up (this happens every time the program is 
executed, assuming that a user does not register the program during the 30 day trial period). 

Because the Shareware option has not expired the first form will be displayed asking the user 
to Register Now or Register Later.  Select the Register Now Option, you will see that all of 
the necessary information has been pre-set in the form's text boxes. 
(After testing you can eliminate these pre-sets by un-remarking or deleting them from 
frmProductRegistration's Form Load Event).

Click on the "Register" command button and Windows Notepad opens displaying the 
registration data, in addition, a file is created in the applications program path named
"MainKeyRegistration.txt"  and if your printer is turned on, the file is printed.  Close Notepad 
and  the Form frmTestApp is displayed.  This would of course be the applications startup 
Form.  From here on out, only the applications start-up form will be displayed each time the
program is run.  You should experiment with the different options, i.e., 

	1.  Delete the Registry Values and re-run the "RegisterSoftware" project
	2.  Save the Settings and re-run the "RegisterSoftware" project selecting
                       the "Register Later" option.

That's about it, good luck.

'***************************************************
'***************************************************
'*****                Application Registration Demo                  ******
'*****                           Registry Module                            ******
'*****              John P. Cunningham - November 2001       ******
'*****                  Web: http://johnpc.freeservers.com          ******
'*****                   Email:  johnpc7@home.com                   ******
'***************************************************
'***************************************************








 
   
