TheScarms(tm) AppSentinel - Referencing and Instantiating AppSentinel
(Version 1.5.0)

INDEX:

VARIABLE LIFE AND SCOPE:
You must create a variable to hold a reference to the AppSentinel object. All sample programs use a global variable named gobjAppSentinel.

It is recommended that AppSentinel be instantiated in the Load event of your first form or at the start of your Sub Main routine. The variable should exist until your application terminates, i.e. the Unload event of your last form or at the end of your Sub Main procedure.

If your application can end from multiple points in code, it must properly dispose of AppSentinel prior to ending by setting the object variable to Nothing. For example:

    Set gobjAppSentinel = Nothing

If AppSentinel is destroyed and recreated during a single session of your application, the TotalRuns of your program as reported by AppSentinel will be higher than the true value possibly causing your trial period to prematurely expire.

Also, if you terminate your application using the END statement, you must set the variable holding a reference to AppSentinel to Nothing first. Otherwise AppSentinel may always report the TotalRuns of your application as 1.


    Incorrect:  ....
                   END

    Correct:    Set gobjAppSentinel = Nothing
                   END
Top

TRIAL vs RELEASE DLL:
There are two versions of the AppSentinel DLL: the free 20 day trial version and the non-expiring release version. All sample programs reference the trial version whose name ends with the letter "T".

To use the release version of the DLL in the sample programs or your code, change all references of the DLL to SEN10L.

When using early binding, the Project | References list distinguishes the trial version with the words Trial Version appended to the end of the DLL's name.

Top

BINDING: - Early Binding vs Late Binding.
All sample programs reference the trial version of the DLL and use Late binding. However, it is recommended your code use Early binding to take advantage of VB's Object Browser and IntelliSense features.

Late Binding:
To use late binding:

  • Declare the variable in your form or module's Declaration section:

        Public gobjAppSentinel As Object


  • Instantiate it in your first Form_Load or Sub Main:

        Set gobjAppSentinel = CreateObject("SEN10LT.Registration")


  • Destroy it in your last Form_Unload or at the end of Sub Main.

        Set gobjAppSentinel = Nothing

Early Binding:
Early binding allows you to use VB's IntelliSense features as you type out AppSentinel's methods and properties. It also let's you view AppSentinel's methods and properties in the Object Browser (press the F2 key while editing your code).

To use early binding:

  • Reference AppSentinel in your application:

    • Click References under the Project menu.
    • Check SEN10LT - Trial Version
    • Click OK.

  • Declare the variable in your form or module's Declaration section:

        Public gobjAppSentinel As New SEN10LT.Registration


  • Destroy it at in your last Form_Unload or at the end of Sub Main.

        Set gobjAppSentinel = Nothing

Top

429 ERROR - ActiveX Object Can't Create Component:
If you get this error you are either referencing the wrong version of the DLL (trial vs release) or the DLL is not registered correctly.

First, verify that the correct DLL is mentioned in your Dim (Public gobjAppSentinel AS ...) or CreateObject statement or under Project | References.

Next, copy Regsvr32.exe to your System folder. This file was included in the download.

To register the DLL:

  • Click Start | Run


  • Type in: Regsvr32 C:\...\xxx.dll

    where ... is the path to the DLL and xxx is the name of either the trial or release DLL.


  • Click OK.
A message with the word succeeded will be displayed.

Top

TheScarms(tm) AppSentinel © Copyright 2002 David Scarmozzino
All Rights Reserved
www.TheScarms.com/AppSentinel