Protection PLUS 5 SDK Sample Applications

The Protection PLUS 5 SDK APIs contain a wide variety of licensing features. There are an assortment of samples available to help demonstrate how licensed applications typically work, how the different licensing features work, and how the APIs may be integrated into your application.

These sample applications are installed with Protection PLUS 5 SDK in archive file format so they may be re-extracted if necessary. On Windows, they can be found by running Protection PLUS 5 SDK and clicking on the Samples link, which will open Windows Explorer to the %PUBLIC%\Documents\SoftwareKey\Protection PLUS 5\Samples directory. On other operating systems, you will choose where to extract the development files during installation, which will include the samples.

Samples for .NET Applications

Important

If you copy and paste any sample code into your own application, make sure your application's copy of the code is configured for your SOLO Server account.

In the %PUBLIC%\Documents\SoftwareKey\Protection PLUS 5\Samples directory, you will find solution files for each supported version of Visual Studio, which reference all of the .NET sample projects.

When running a sample project, you may notice Visual Studio starts ASP.NET Developer Server, even when you are not explicitly running one of the ASP.NET samples. To prevent this, you can select the ASP.NET sample projects in Solution Explorer, open the properties pane (or press F4), and change the "Always Start When Debugging" setting to False.

PLUSManaged Samples

The PLUSManaged samples show you how you can integrate the PLUSManaged API with any of your .NET applications. Note that these samples lack integration with PLUSManagedGui that is included with the newer samples outlined below. Even though most of these samples do use Windows Forms, it is simple to re-use most of this sample code with nearly any type of interface (as shown with the ASP.NET samples that are included). These samples are especially useful when your application (such as web applications, services, etc...) cannot use a traditional dialog/form based interface.

PLUSManagedGui Samples

The PLUSManagedGui samples are similar to the PLUSManaged samples, but they also integrate with PLUSManagedGui which is a component that includes a graphical user interface (GUI) for licensing. This means that these samples (and applications based off them) need less code for typical licensing GUI functionality. Consequently, these samples are also designed to better separate the licensing implementation from the application's user interface.  The end result is sample code that is easier to follow and easier for you to re-use in your own applications.

Samples for Native Applications

The PLUSNative samples show you how you can integrate the PLUSNative API with your applications. These samples include support for a variety of popular languages and GUI frameworks, including (but not limited to) C++ with MFC, C++ with wxWidgets, Delphi, Objective C, and Visual Basic 6.

Running the Sample Applications

The sample applications are only shipped as source code, so each sample must be compiled before it may be launched. Once compiled, the output executable/binary (or .EXE file) will be located in the project directory. For .NET applications, this is under the bin\Debug or bin\Release sub-directory (depending on which build configuration you selected before compiling). For native applications, this varies upon the target architecture (such as Win32 or x64) and the selected build configuration (Debug or Release). You may either run the samples from by double-clicking the executable/binary file in the output directory, or by clicking a "Run" or "Start Debugging" menu option or toolbar button in your integrated development environment (IDE - e.g. Eclipse, Visual Studio, etc...).

Testing Activation and ELM

For more information about testing activation and Electronic License Management, read more about using SOLO Server and creating licenses.

Important

The sample applications are designed to require activation, just as your protected application would after integration is complete. Before evaluating and running the sample applications, you should become familiar with how to add test licenses in SOLO Server.

Clearing License Files and Aliases

It is often necessary to run or debug the application in a scenario where it would behave like it is running on a computer for the very first time. By deleting all of the license files and aliases, you can quickly return the application to a state expected when it is run on a computer for the very first time. By default, the sample applications are configured to store the files in the same directory as the executable (or .EXE) file, while using file names such as LicenseFile.xml, VolumeLicenseFile.xml (for downloadable and volume licenses), LicenseAlias1.xml, and LicenseAlias2.xml. These locations are defined in the sample application source code. For example, with PLUSManagedGui samples, you should refer to the LicenseConfiguration class, which contains properties (Aliases, LicenseFilePath, and VolumeLicenseFilePath) that define where these files are saved. With PLUSNative samples, you should find and evaluate source code which calls functions like SK_PLUS_LicenseFileLoad and SK_PLUS_LicenseAliasAdd to determine where these files are stored.