 |
Use
the ProtectSoft Administrator to create keys and
options. |
 |
Include
the ProtectSoft header and class file in your
source code. |
 |
Change
the main program of your source code to verify the
key is not expired and check the options
allowable for this key. |
 |
Show
the user how many days are left in the
license. |
 |
Sell
your software safely. |
|
|
| Create
Keys |
- From the
Windows Start Menu select:
|
|
Programs
> Tiera ProtectSoft
|
- Once the
Administrator starts, select:
|
|
File
> New menu |
- Enter the key
information
|
- Generate the
key by selecting
|
|
File
> New |
- Set the
appropriate options as shown below:
|
|
| Include
the header files |
- Add the
following statement in the beginning of you
main program:
|
|
"include
LicenseFile.h" |
- Add the
LicenseFile.cpp source file to your project.
|
| Change
the main program and add the following code snipet. |
|
CLicenseFile lf;
//Create the License file object
if (lf.Read("Licensekey", "License.lic") == FALSE)
{
CString Out;
Out.Format("Invalid License File (%s): Error %s ", buff, lf.GetErrorMsg());
AfxMessageBox(Out);
return FALSE;
}
|
|
| Show
the user how many days remain |
|
m_nDays =
lf.DaysToExpire();
if (m_nDays <= 5 && m_nDays > 0 ) //less than five days to go
{
if (AfxMessageBox("This license is about to expire. Would you like to purchase?",
MB_ICONSTOP) == IDYES)
{
ShellExecute(NULL, "open", "http://www.yoursite.com/purchase.htm","","",
SW_SHOW);
return FALSE;
}
}
if (m_nDays <= 0) // License is no longer valid
{
if (AfxMessageBox("This license is expired. Would you like to purchase?",
MB_ICONSTOP) == IDYES)
{
ShellExecute(NULL, "open", "http://www.yoursite.com/purchase.htm","","",
SW_SHOW);
return FALSE;
}
else
{
return FALSE;
}
} |
|
| Thats
all! |
|