|
Overview
Detailed step-by-step instructions. The following is a set of detailed step-by-step instructions for adding copy protection to a Visual C++ application. All of the code samples shown can be found in the API\API\DEMO SOURCE\VC directory that contains the source code for the demonstration application. 1. Copy the .h and .lib files from the API\API\VC directory into the appropriate places within your application's project directory 2. Copy the following header files from the API\API\DEMO SOURCE\VC directory to your project directory:
3. Copy the following source files from the API\API\DEMO SOURCE\VC directory to your project directory:
4. Open your application in the Visual C++ development environment. 5. Add the files you copied across in Step 3 to your project. The m_pSheriff->Register call in the RegisterProduct() method should be changed to mention the name of your application rather than the Sheriff Demo. 6. Add the SlsLib.lib file to the Link settings of your Release build. This will statically link the Sheriff SDK into your code. 7. Add the SlsLibD.lib file to the Link settings of your Debug build. 8. Copy the following methods from the CWinApp derived class in SlsDemo.cpp file (in the API\API\DEMO SOURCE\VC directory) to your own CWinApp derived class:
9. Near the top of this file place the Sheriff Product ID and Secret Codes for your application. If you do not yet have your own Product ID and Secret Codes you can use the evaluation versions.
10. At the top of your file place the following includes:
#include "ExportDlg.h" 11. From the CSlsDemoApp Class definition in the SlsDemo.h header file (in the API\API\DEMO SOURCE\VC directory) copy the following lines to your own CWinApp derived class definition:
CSheriff *m_pSheriff; 12. Add the following include to your header file: #include "sheriff.h" 13. Add the dialog resources from the SlsDemo project to your own project (these are used by the Sheriff SDK and allow you to create customized versions of your own).
14. Add the following lines of code to your CWinApp derived class contructor: m_pSheriff=NULL; 15. Add the following to your class destructor: delete m_pSheriff; 16. Add this to your ExitInstance method: if(!m_bRunInDemoMode) 17. Add this to your InitInstance method: //Change the registry key under which the Sheriff settings are stored. Don't forget to change the name passed to the SetRegistryKey function to something appropriate to your company.
18. Build your project.
19. The first time you run your application it will register itself and display a dialog box that lets you either enter a licence key or continue running as a demo application.
These instructions show one way of adding copy protection to a C++ application (based on the demo application supplied with the SDK). See elsewhere in this help file for information about the other ways.
Now that you have a version of your application that uses Sheriff copy protection you can go over the code you added and make any necessary changes to customise the implementation
|