Shareware Function Library
by Brian Veditz
The enclosed libraries were designed specifically for
shareware authors, but can be used by anyone needing such
functions. Some of the functions are general and can be used
for any program and some are more specific. I have not
released the source because some of the functions
(Specifically the Register and Encryption functions) will be
more protected this way. You can find the QLB and LIB
enclosed which are easily added to your programs.
Two of the most important features of this Library are the
Registration Codes and the Encryption Process. In these
functions you have to ability to make your software protected
from unregistered users or users illegally gaining access to
information they shouldn't be into. Using both the
registration codes and the Encryption process on important
passwords or perhaps your name as it is shown in the program
will protect your software so that it is almost impossible to
crack. Using the Encryption and Registration on words that
are shown in your software such as "Unregistered Version" can
keep from hackers editing or EXE or Data files.
There is no cost for using these routines and you are at
your own risk when doing so. As far as I know there are no
bugs or other errors in the coding, but your on your own if
you choose to use this software. I accept no liability for
the use of these functions. If you do use these routines a
registered version of your software would be a nice jesture,
but in no way required. If you have any problems with the
functions let me know, my BBS Number is (818) 999-5488 and you
can contact me there.
Using the routines is simple. When your coding in the QB
Environment type QB /L QB4SWLIB.QLB and the routine will be
loaded for your use. When you wish to compile your software,
after running your basic program through BC and choosing to
link, it will ask you Library names, type in QB4SWLIB.LIB and
your program will be compiled (Or choose that file name from
the QB environment if thats where you do your compiling).
Also, at the beginning of your program you must add the line
this line sets up your program to recognize the functions
added by the QB4SWLIB.
Sorry for the poor quality of the Documentation, I'm not
too good at this and I'm also typing fast to get this done
(boy is it boring), as I said, if you having any problems give
my board a call and leave me a comment (its an instant access
board). Hope these routines will be of some use to you, and
The Informer BBS
Registration Codes are used in software to engage or
disable certain features from registered/un-registered
versions of your software. The registrations codes used here
can be up to 6 digites long (999999). The Code is a private
code for use in the Registering. The code should be different
for each program you make, but be sure you keep this code for
registering users for a specific program.
Use: Ok!=Get.Register!(Name$, Try!, Code%)
Purpose: Check if a registration code is correct.
Example: Ok!=Get.Register!("Brian Veditz", 229694, 2930)
This function is used in conjunction with the Register
Function. Whenever you create a piece of software you should
pick a new code% which can be any number from 0 to 32767
(Greater then 0 is suggested). The Try! above is the code the
user enters as his registration number. When you want to
register the software you have the user enter his / her name
exactly as they want it (the Register functions are case
sensitive) and the code (as Try!) that they are given by you.
If the number is correct they get a 1 returned and if it is
wrong a 0 is returned. Use these values in the software to
enable/disable the features or whatever that you want.
Use: Reg!=Register!(Name$, Code%)
Purpose: Make a registration code for a specific name and
Example: Reg! = Register!("Brian Veditz", 2930)
The Registration function is used to find what the
registration code for a specific name (or other string) would
be. The code after it, 2930 above, which can be any number
under 32767 is used as an encoding process. This routine
would be used for your private software. Be sure that the
Code% in your private software (2930 above) is the same as the
software your user is using. If the # is different the users
software will not register. When you run this routine with
the correct code and the name exactly as your user wants it
Register will return a Registration code value which you can
in turn give to your users. No two users should have the same
code, but it is not impossible. If for some reason they do,
try adding a "!" to the end, or whatever. If they do have the
same code, it won't cause any problems of course except for
Encryption is used for hiding strings in your programs or
data files from prying eyes. The Encryption process is fairly
simple to use and in design, but can be difficult to crack if
you take advantage of all the features of the functions. Read
the advanced section for more uses for these functions.
Use: Newln$ = Encrypt$(Ln$, Code%, Add$)
Purpose: Encrypt Names, Lines, Passwords, Etc.
Example: Newln$ = Encrypt$("Brian Veditz",3487, ".,)(*&%[email protected]
When encrypting, The Newln$ will be the encryted line that
the function returns. Ln$ is the Line to Encrypt. Code%,
like in the registration process, is a misc number to further
add to the encryption process. Add$ are characters that you
will allow to be encrypted besides the standard set. The
standard set is A-Z, a-z, 1-9, and the "'" character
(not the quotes around it though). If there are any other
characters you wish to use you can include them in the add$.
Even if you don't have any, to further personalize your
encryption process, it is advised to add some characters to
the Add$. Whatever you do, don't duplicate any characters or
use any characters allready in the standard set.
Use: Newln$ = Decrypt$(Ln$, Code%, Add$)
Purpose: Decrypt lines encrypted with above function.
Example: Newln$ = Decrypt$("@9h24F'7gh31",3487, ".,)(*&%[email protected]!")
If you wish to decrypt a string you must know the code you
used to encrypt it and any ADD$ you may have used, otherwise
you won't be able to decrypt the String. If someone tries to
break your coding without the proper decrypting ADD$ and the
decrypt program can't decrypt a certain character because its
not in the ADD$, the decrypt program will throw one in there
instead of telling the decrypter. This makes it a little more
difficult for a cracker since they won't know what they can
use and what they can't. By using the code% and ADD$ its very
unlikely someone will crack your code, and not without a lot
of work (doubtfull they would even know how). If you forgot
the ADD$ or Code% you might as well forget decrypting it, and
don't come to me since I can't do it either (The crypting work
is done by you not by me, I only have a routine here, your the
one who will do the coding by using the Code% and add$).
Below are different string manipulation functions. These
are useful for filtering, centering, replacing, translating
and in other ways manipulating strings into the form you want.
Most are simple to use and you'll know what they do at first
Use: PRINT Center$(Ln$, Length%)
Purpose: Center a line
Example: PRINT Center$ ("this line will Centered", 80)
This function is used to center a line however long you
wish it to be. The length% is the length of the area you want
to center the string in. 80 is the lenght of a screen, so the
example above would center the line on the screen. If you are
in 40 columns you would use 40 instead of 80. If you wish to
center a line to put into a box you could do:
LN$ = Center$(LN$, 22)
Ln$ would now be padded enough spaces that if you printed it
in a box 22 characters wide it would be centered. If the line
is longer then length% the line will not be Centered.
Use: Ln$ = Justify$(Ln$, Length%)
Purpose: Justify a line to the proper length.
Example: Print Justify$("Justify this line", 20)
This function will justify a line to the proper characters
long (as specified in length%). This is great for word
processors and such that pretty up the docs. The docs here
have been justified. You can specify the length as according
to what your users may have the Right and left margins set for
or whatever other uses you may have for this.
Use: Ln$ = Spaceit$(Ln$, Length%)
Purpose: Replace tabs with length% of spaces.
Example: Ln$ = Spaceit$(Chr$(9)+Ln$, 6)
This will replace the tabs in each line with the amount of
spaces specified in length% (6 in the above example). Good
for removing those tabs and putting in something easier to
Use: Ln$ = Replace$(Ln$, Find$, Change$)
Purpose: Replace all occurances of one string with another.
Example: Ln$ = Replace$(Ln$, "Hello", "Hi")
Replace is a handy little function that will replace all
occurances of one string with another. As with the above
example, all occurances of "Hello" in Ln$ will be changed to
the word "Hi". The string to change to can be longer or
shorter than the original string, the replace function will
take care of everything. Another handy addition to a word
processor or text converter program.
Use: Ln$ = Translate$(Ln$, old$, new$)
Purpose: Run string(s) through a translate table.
Example: Ln$ = Replace$(Ln$, "!?;", "...")
A translate table has uses sometimes. The above example
would exchange all occurances of "!?;" with "."'s. Why? I
dunno, but heres another idea. Suppose your writing a BBS
program and someone calls without an IBM but you don't want to
make seperate non-Ibm character menus for those few. Well
great, just put those IBM characters in Old$ and something
thats semi-equivalent in New$ using standard keyboard
characters, and now you can support those users. There are
many other uses that may come to mind.
Use: Ln$ = Filter$ (Ln$, Find$)
Purpose: Filter out all characters in Find$
Example: Ln$ = Filter$ (Ln$, ",!%&.-+")
In the example above the filter$ would filter out
characters you may not want when getting a number. The filter
can be used to filter out any characters that you may not want
when getting a string of some type. The Filter function will
remove the character completely like it was never there. A
nice toy to add to a BBS or modem program when you want to
remove most occurances of line noise.
Use: A% = Parser%(COMMAND$, Split$(), Find$)
Purpose: Split up lines at a given character
Example A% = Parser%("Line-1 Line-2 Line-3", Split$(), " ")
The parser can be used to seperate words/commands from the
Command$. The Find$ is the character you want to separate at,
this is normally a space, but it can be anything. Split$()
must be dimensioned before you use it to how many splits you
expect to allow. You can run the the command$ through
multiple parsers if you like, it'll just take a little extra
coding. The above example will send back a% as 3 and
Split$(1) as "Line-1", Split$(2) as "Line-2" and Split$(3) as
"Line-3"... the number of words your command$ is split into
is defined in the returned value (A% above).
The following are functions that deal with numbers.
Use: Num! = Pick!(Low!, High!)
Purpose: Pick a random number between Low! and High!
Example: Num! = Pick!(100, 200)
An average little random number generator. This one will
pick numbers between two numbers. It supports numbers into
Use: Num# = Round#(Num#)
Purpose: Round to nearest possitive or negative number.
Example: Num# = Round#(-305.33)
This will round numbers. Works better then the Int
function and handles both positive or negative numbers.
Use: Num# = Roundcent#(Num#)
Purpose: Round to nearest positive cent.
Example: Num# = Round#(305.3345)
This little function will round to the nearest positive
cent. Useful for those tax programs. This will get you past
the math junk in your programs and get you back to drawing
your pretty menus. 🙂
Date and Time conversions into a Human version.
Use: Newdate$ = Realdate$(Date$)
Purpose: Convert date to a nice format
Example: PRINT Realdate$(date$)
Tired of those stupid 11/09/91 or 11-09-1991 formats of
dates. This will convert both formats into a nice readable
date. The above would be displayed "November 9, 1991". This
support goes into the early next century if you have the old
date format "11/09/91" and even further if you use the newer
Use: Thetime$ = Realtime$(Time$)
Purpose: Convert the time into an easy readable form.
Example: PRINT Realtime$(Time$)
This will convert the normal "18:32:21" into the format
"6:32 pm". It gets rid of the seconds but converts the time
you give to the proper time, minutes and AM/PM.