Note: This documentation refers to License System 1, new users should useLicense System 2instead.
Accessing Trial Information from your program.
Before Thinstall runs your program it sets some environment variables so your program can act differently or display information to the user about registration:
TS_SERIAL : serial number if registered, or NULL if not registered. You can check for this environment variable to have reduced functionality for non-registered users. TS_SERIAL will be a 32-bit integer, and you may use bits of the serial number to represent additional features. For example:
char serial[10]; // if you don't want a feature usable in the trial if (GetEnvironmentVariable("TS_SERIAL", serial, sizeof(serial)))
do_registered_only_feature();
// if you want to sell a feature separately if (GetEnvironmentVariable("TS_SERIAL", serial, sizeof(serial)))
{
if (atoi(serial)&1) // is the serial number odd or even? do_expensive_feature(); // odd serial numbers cost more else do_cheap_feature();
}
If TS_SERIAL is already set when your program runs, Thinstall will delete the environment variable to prevent users using registered functionality.
TS_MACHINEID : If you want to have lock-based serial numbers and don't want to require the user to cut & paste the serial numbers you can use this environment variable to send the machine id to you automatically. For example:
TS_DAYSUSED : If the user hasn't registered yet, this variable holds an integer containing the number of days since they have installed the software package. This variable can be used to provide further warnings or functionality degradation as time passes.
Note for Visual Basic Users
Because the Visual Basic Runtime collects a list of Environment variables before the program starts, the Environ() function will not reflect the changes made by Thinstall. To solve this problem you should do one of
2 things:
1. Use the Win32 API Call GetEnvironmentVariable() instead of Environ()
2. Add MSVBVM60.DLL to your EXE. This causes it to be removed as a direct dependency from your program - and Thinstall will load the VB Runtime after the trial demo environment variables have been set.