TShareWare Component v2.0 For Delphi 16/32 Bit Copyright 1996 Intenseware TECHNICAL SUPPORT VIA E-MAIL 103256.3104@compuserve.com What is TShareWare? TShareware is a custom Delphi component that allows you to control usage of your Delphi programs by unregistered users. By dropping this component onto your project and adding a few lines of code, you can start distributing "crippled" versions of your programs, and hopefully receive many registrations. Shareware can be very profitable for you, and beneficial to customers who like to "try before they buy"! How Does it Work? There are several types of shareware commonly seen in the software market today. TShareWare supports three types: NagWare, CounterWare, and TimerWare. NagWare is the most common type, and prompts users to register by displaying a popup dialog at inconvienent times, sometimes frequently. Counterware "counts" how many times a user runs a particular program, and notifies them when they have reached the limit. TimerWare allows users to use a program for a specified time from the date of installing. A new feature called Delphi_IDE allows your project or component to run in Delphi only. The Secret File To protect your TimerWare and CounterWare from cheaters who will definitely try to beat the program by re-installing or changing the system date, TShareWare stores it's information in a special file written to the user's WINDOWS directory. The only way to restart the TimerWare or CounterWare is to delete this file. Fortunately, we have provided several ways to disguise this file so users would have to find a needle in a haystack! You are the only person who will know about the "secret" file. Installing TShareWare To install the TShareWare component, first create a subdirectory of DELPHI called INTENSE or use another directory on your Delphi search path. Next, unzip the file SHWARE.ZIP into the directory, and launch DELPHI. Next, in Delphi, select OPTIONS | INSTALL COMPONENTS, click ADD, and then type in the location of the directory. Locate the file called SHWARE.PAS and select it. Now press OK to rebuild the library. A component group called INTENSE should appear, and TShareWare should be inside. For Delphi2, you should copy all of the SHWARE32 files to a directory off of your Delphi2.0 search path and install the file SHWARE32.PAS to your library from the COMPONENT menu. The documentation is the same for both components. Making a Project Shareware To use TShareWare in your Delphi project, first drop a TShareWare component anywhere on your main form. You should then customize the component for your program by modifying its properties (see list of properties). Whenever you need to display the shareware dialog, add this line of code: Shareware1.Execute. We suggest adding this line to your form's OnClose or OnCreate events. The following line of code will check the status of the shareware to see if it has expired: If Shareware1.ShareStatus = ssExpired then {do something} That's all you'll need to use the basic features of the component. Making a Component Shareware To make a component shareware requires a more advanced understanding of Delphi, and a few extra lines of code. To use TShareWare in your custom component, add SHWARE to your component's USES clause. Next, add the following lines to your component's CONSTRUCTOR, or another CAREFULLY chosen spot in your code: Var ShareWare1 : TShareWare; Begin ShareWare1 := TShareWare.Create(Self); {modify shareware properties here} ShareWare1.Execute; {check shareware status if desired} ShareWare1.Free; end; Note: Be careful where you place this code! If you place it in the wrong spot, you may interfere with normal Delphi operations and cause problems. We advise not to place TShareWare in the DESTRUCTOR or LOADED procedures. Customizing TShareWare By changing the properties of the TShareWare component, either at design-time or at run-time, you can customize it for your program. The following pages define each of TShareWare's properties and events. You should know what all of the properties do to take full advantage of the component. NOTE: DO NOT DISTRIBUTE SHWARE.PAS WITH YOUR PROGRAM FILES. USERS SHOULD NOT HAVE ACCESS TO THE TSHAREWARE PROGRAM ITSELF! TShareWare Properties and Events property AutoPreview : (prOFF, prON) By changing AutoPreview to prON, the ShareWare dialog will pop up exactly as it will appear in your program. This will allow you to preview it at design-time. property BlockHeader + Blockheader contains nested properties about the first "block" of the dialog. This is usually the title of the product or program. property BlockHeader.AlignmentText : (taCenter, taLeft, taRight) Aligns the text in the block. property BlockHeader.BorderStyle : (bsNone, bsSingle) Selects a border for the block property BlockHeader.Color : TColor Selects the background color for the block property BlockHeader.Ctl3D : Boolean Selects a 3-D look for the block property BlockHeader.Font : TFont Selects the font for the block property BlockHeader.Lines : TStrings Edits strings that make up the block text. ** Note: We have recognized a problem with the RZStringlist property editor when used to edit BlockHeader Lines. This is not a problem with TShareWare, as it appears the RZ editor was not designed for "nested" TStrings properties. property BlockHeader.ScrollBars : (ssNone, ssVertical, ssHorizontal, ssBoth) Enables scrollbars for the block text. property BlockInfo + Blockinfo contains nested properties about the second "block" of the dialog. This is usually a brief or detailed description of the product, and registration terms. property BlockInfo.AlignmentText : (taCenter, taLeft, taRight) Aligns the text in the block. property BlockInfo.BorderStyle : (bsNone, bsSingle) Selects a border for the block property BlockInfo.Color : TColor Selects the background color for the block property BlockInfo.Ctl3D : Boolean Selects a 3-D look for the block property BlockInfo.Font : TFont Selects the font for the block property BlockInfo.Lines : TStrings Edits strings that make up the block text. ** Note: We have recognized a problem with the RZStringlist property editor when used to edit BlockHeader Lines. This is not a problem with TShareWare, as it appears the RZ editor was not designed for "nested" TStrings properties. property BlockInfo.ScrollBars : (ssNone, ssVertical, ssHorizontal, ssBoth) Enables scrollbars for the block text. property BlockOrder + BlockOrder contains nested properties about the first "block" of the dialog. This is usually the ordering and pricing information about the product. property BlockOrder.AlignmentText : (taCenter, taLeft, taRight) Aligns the text in the block. property BlockOrder.BorderStyle : (bsNone, bsSingle) Selects a border for the block property BlockOrder.Color : TColor Selects the background color for the block property BlockOrder.Ctl3D : Boolean Selects a 3-D look for the block property BlockOrder.Font : TFont Selects the font for the block property BlockOrder.Lines : TStrings Edits strings that make up the block text. ** Note: We have recognized a problem with the RZStringlist property editor when used to edit BlockHeader Lines. This is not a problem with TShareWare, as it appears the RZ editor was not designed for "nested" TStrings properties. property BlockOrder.ScrollBars : (ssNone, ssVertical, ssHorizontal, ssBoth) Enables scrollbars for the block text. property Caption : String Sets the caption of the shareware dialog window property Color : TColor Sets the color of the shareware dialog form property DisplayStatus : Boolean Determines whether or not the dialog will display the registration status at the bottom of the form. property Enabled : boolean Setting enabled to false will stop the dialog from being displayed even if the Execute method is called. property FileDate : String Sets the date of the "secret file". We suggest using a date that will be difficult to pick out from the other files in the WINDOWS directory. If you do not specify a date, the current date will be used. property FileHide : Boolean Setting this property to true will make the "secret file" attribute hidden. property FileName : String This property contains the name of the "secret file". We suggest using a name that will fool nosy users, such as WINDAT.DLL or any other disguising name. **Note: If you do not specify a filename, the "secret file" will be disabled, and TimerWare and CountWare will never change statuses! property FileSize : Integer Sets the size of the "secret file". For hiding purposes, we allow variable sizes. You must specify a file size between 32 and 32,000 for the "secret file" to work. property Font : TFont Sets the font for the dialog. Only affects the ShareStatus label and button captions. property MaxCount : Integer Sets the maximum number of times that CountWare allows users run a program. property MaxDays : Integer Sets the maximum number of days that TimerWare allows users run a program. property Name : String Name of the component property Password : String Upon entering a password , a "register" button will appear on the dialog. Users can then register the component at any time after purchasing a password from you. property ShareStatus : (ssUnRegistered, ssRegistered, ssExpired, ssTampered) ShareStatus allows you to check the current status of the shareware program. You can use ShareStatus in your program to trigger other events in your program. ssExpired means the user has exceeded the limit of TimerWare or CounterWare. ssUnRegistered means the software has not been registered, but has not expired. ssRegistered means the user has entered the correct password to register. ssTampered means the user has modified the "secret file" or changed the date! property ShareType : (stNagWare, stCounterWare, stTimerWare, stDelphi_IDE) ShareType sets the type of shareware. Note that TimerWare and CounterWare require other important properties to be set to work properly. If you set it to Delphi_IDE, you can create a program that will only work while Delphi is running. property SilentMode : boolean SilentMode allows you to use the ShareStatus and Timer/Counter features of TShareWare without displaying a dialog. You can use your own dialog based upon ShareStatus if you wish. ** Note: ShareStatus is not updated until a call to EXECUTE is made. You should turn SilentMode on, and then call EXECUTE before checking ShareStatus! property Tag : Integer Component tag. Read-only property RemainCount : Integer Contains current uses left in CounterWare. Read-only property RemainDays : Integer Contains current Days left in TimerWare. event OnBeforeShow : Occurs just before dialog is displayed. event OnAfterShow : Occurs just after dialog is displayed. event OnRegister : Occurs after correct password has been input, and status = ssRegistered. method Execute : Displays the TShareWare dialog and updates the ShareWare status. method DelphiRunning : boolean Allows you to determine if Delphi is running. Also used internally for stDelphi_IDE. You can check if Delphi is Running, and if not, warn the user that your application will terminate unless they register or run Delphi.