IPSentry Add-In SDK
Code Sample - VB6
Add-In SDK Index | Top
sep

The following code sample represents a basic interface structure for the primary class allowing IPSentry to interface with your add-in component as a COM/ActiveX component.  This is intended for general reference purposes and is not intended for general usage.

 

Visual Basic
Option Explicit

'The following code represents the basic interface requirements for development
'of an IPSentry add-in in Visual Basic (VB6)
'
'Notes:
' Create a new ActiveX DLL
' Name your primary Class module accordingly.
' Instancing of 'multiuse'


'-----------------------------------------------------------------------------------
'Enumeration to represent the abilities of the add-in.
Enum EN_AddInUseType
    CIPS_ADDIN_NONE = 0 'No add-in usage type defined.
    CIPS_ADDIN_MONITOR = 1 'The add-in can be used as a monitoring entry.
    CIPS_ADDIN_ALERT = 2 'The add-in can be used as an alerting function.
    CIPS_ADDIN_CUSTOM_MONITOR = 8 'Monitoring configuration interface    exists.
    CIPS_ADDIN_CUSTOM_ALERT = 16 'Alerting configuration interface exists.
End Enum

'-----------------------------------------------------------------------------------
' Perform class initialization logic here.
Private Sub Class_Initialize()

End Sub


'-----------------------------------------------------------------------------------
' Perform class termination cleanup here.
Private Sub Class_Terminate()

End Sub

'-----------------------------------------------------------------------------------
' Caller is requesting information about the add-in. This procedure should
' instantiate an 'about' dialogue for the user.
Public Sub About()
    MsgBox "This is my control.", _
    vbOkOnly + vbInformation, _
    "My Add-in"
End Sub

'-----------------------------------------------------------------------------------
' Return the valid usage types available for this add-in based on
' EN_AddInUseType values.
Public Property Get IPSUseType() As Long
    IPSUseType = EN_AddInUseType.CIPS_ADDIN_MONITOR + _
                 EN_AddInUseType.CIPS_ADDIN_CUSTOM_MONITOR
End Property

'-----------------------------------------------------------------------------------
' The title or friendly name of this add-in
Public Property Get IPSTitle() As String
    IPSTitle = "My Add-in Control in VB"
End Property

'-----------------------------------------------------------------------------------
' The long description of this add-in
Public Property Get IPSDescription() As String
    IPSDescription = "This add-in doesn't do anything, it is just an example."
End Property

'-----------------------------------------------------------------------------------
' Called to notify the add-in of the running context of the application.
Public Property Let IPSIsService(ByVal value As Boolean)
    'Store the value passed for reference in your add-in code.
End Property

'-----------------------------------------------------------------------------------
' Called to perform the add-in monitoring task.
Public Function IPSMonitor(ByVal MUID As String, ByVal Args As String) As Long
    Dim myResult As Long
    myResult = -1

    'Perform whatever monitoring tasks are required after parsing the Args value.
    'Return your result as 0=(OK) or -1=(Critical).

    IPSMonitor = myResult

End Function

'-----------------------------------------------------------------------------------
' Called to configure add-in specifications.
Public Sub IPSMonitorConfig(ByVal MUID As String, ByRef Args As String)
    Dim newArgs As String
    newArgs = Args

    'Perform necessary logic to obtain configuration data for this add-in.
    'If user accepts the changes, return the configuration data.
    Args = newArgs
End Sub

'-----------------------------------------------------------------------------------
' Provides the caller with verbose description of the monitoring task.
Public Property Get IPSMonitorResult() As String
    IPSMonitorResult = "Information about the monitoring process results."
End Property

'-----------------------------------------------------------------------------------
' Caller has requested that the add-in stop monitoring.
Public Sub IPSMonitorStop()
    'Set a value noting that the monitoring task has been requested to stop.
    'this value should be checked while performing monitoring.
End Sub

'-----------------------------------------------------------------------------------
' Returns the date/time associated with the graph enabled data values
Public Property Get GraphDate() As Date
    GraphDate = Now
End Property

'-----------------------------------------------------------------------------------
' Returns the total time (in ms) for the add-in to perform the monitoring process

Public Property Get GraphProcTime() As Long
    'Return the total time (in ms) for the add-in to
    'perform the monitoring process.
    GraphProcTime = SomeCalculatedValue
End Property

'-----------------------------------------------------------------------------------
' Returns the graph state result (absolute and reverse values of IPSMonitorResult.
Public Property Get GraphResult() As Long
    'If failed, return zero (0).
    'If success, return one (1).
    GraphResult = 0
End Property

'-----------------------------------------------------------------------------------
' Return multiple graph value items in a collection of strings.
' Each item contains XML gValue element of the graph enabled value:
' <gValue Name=”” Value=”” Scale=”” Desc=”” State=”” IsGlobal=”0” />
Public Property Get GraphItems() As Collection
    'Return a collection of graph items.
    Dim myCollection As New Collection

    'Add the graph items to the collection
    '(do something here to do this)
    Set GraphItems = myCollection
End Property

'-----------------------------------------------------------------------------------
' Called to perform the add-in alerting task.
Public Function IPSAlert(ByVal MUID As String, _
                         ByVal AUID As String, _
                         ByVal Args As String) As Long
    Dim myResult As Long
    myResult = -1

    'Perform whatever alerting tasks are required after parsing the Args value.
    'Return your result as 0=(OK) or -1=(Critical).

    IPSAlert = myResult

End Function

'-----------------------------------------------------------------------------------
' Called to configure add-in alert specifications.
Public Sub IPSAlertConfig(ByVal MUID As String, _
                          ByVal AUID As String, _
                          ByRef Args As String)
    Dim newArgs As String
    newArgs = Args

    'Perform necessary logic to obtain configuration data for this add-in.
    'If user accepts the changes, return the configuration data.
    Args = newArgs
End Sub

'-----------------------------------------------------------------------------------
' Provides the caller with verbose description of the alerting task results.
Public Property Get IPSAlertResult() As String
    IPSAlertResult = "Information about the alerting process results."
End Property

'-----------------------------------------------------------------------------------
' Caller has requested that the add-in stop alerting process.
Public Sub IPSAlertStop()
    'Set a value noting that the alerting task has been requested to stop.
    'this value should be checked while performing alerting.
End Sub

'(c)2008 - RGE, Inc.

sep

© 2011 by RGE, Inc.  (All Rights Reserved)
Unauthorized use or reproduction is strictly prohibited
IPSentry® is a registered trademark of RGE, Inc.

https://ipsentry.com
 Support@ipsentry.com