Instant Protection PLUS 3 DLL Microsoft Access Sample

 

This is a guide which shows you the steps taken to create the Microsoft Access example for the Instant Protection PLUS 3 DLL. This sample was created in Microsoft Access 2010. The instructions would be similar for older versions of Microsoft Access.

Important

Microsoft Office applications (such as Word, Excel, Access, etc...) may run in a ClickToRun environment.  This environment has known limitations that make it problematic for licensed Office add-ins and macros to use global locations. Consequently, licensed add-ins and macros that target these environments should only use user-specific locations for licenses and aliases. See this knowledge-base article for more details.

Step 1 - Creating a new Project

Open Microsoft Access and select Blank database from the available templates. Enter a file name and click 'Create'. Clicking the folder icon next to the file name opens the folder browse dialog where the "Save as type" can be changed to support older Access Database formats. Access 2000 format was chosen for this sample, though this is not a requirement.

Step 2 - Creating a simple form

Click the 'Create' tab from the ribbon menu and choose 'Form Design' to create a blank form named Form1. This form represents the licensed application and will not be accessible unless the application has been activated or running in a valid trial period. A simple label was added to the form to give it some content. Save the form as 'Form1'.

Step 3 - Creating an autoexec macro

Click the 'Create' tab from the ribbon menu and choose 'Macro' to create a new macro. From the Add New Action drop-down choose the 'RunCode' action. Enter init() for the function name to run when the macro is executed. From the Add New Action drop-down choose the 'OpenForm' action. Select 'Form1' for the form name and choose dialog for the window mode. Save the macro as 'autoexec' to create an auto-execute macro that will run on start-up.

Step 4 - Importing the Visual Basic module

Open the VBA editor (Alt+F11). Right-click the project name from the Project Explorer and choose 'Import Fileā€¦". Browse to the IP2Lib32_Definitions.bas module and click 'Open'. This module contains the init() function that is called by the autoexec macro. Save the changes and close Microsoft Access.

Important Steps:
  1. Open the Instant Protection PLUS 3 wizard, open your ".ipp" file, and go to the File Output step (requires that you select "Use the Instant Protection PLUS 3 DLL" on the Integration Method step just before it). This dialog will contain 3 pivotal pieces of information you need for the DLL to work with your program: 1. the decryption key, 2. the return key/return code, and 3. the name of the file saved.  
  2. Replace key = ... with the Decryption Key from the Instant Protection PLUS 3 wizard as mentioned in step 1.
  3. Replace exp = ... with the Return Key from the Instant Protection PLUS 3 wizard as mentioned in step 1.
  4. In the code, note that the line where "sample.xml" is located. This sample puts the XML file in the same directory as the program, which is recommended. Keep in mind that your XML file may have a different name depending on what you specified as the file to save on the "File Output" step of the Instant Protection PLUS 3 wizard.  

Step 5 - Run and Test

When the sample database is opened in Microsoft Access the autoexec macro will automatically execute and run the init() function. The init() function calls the Instant Protection PLUS 3 DLL to check the license status and will open the main application's form if the application has been activated or is running in a valid trial period. If the license is found to be invalid or the trial has expired the application will display a message box that says the application is not licensed for use.

Click 'Evaluate' to load the Microsoft Access application.

Step 6 - Protect

Important

It is very important that you take measures to prevent users from viewing and editing your VBA macros. Microsoft Access includes functionality for protecting this code, so we strongly recommend you read more about protecting your macros.

Step 7 - Test and Deploy

The application must be properly deployed in order to function correctly on a 'clean' machine that has not previously had Instant Protection PLUS 3 installed. The Instant Protection PLUS 3 DLL library files must be installed to the system directory along with any custom splashscreen or product logo images. These requirements are described in detail in the Deployment topic.