' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * ' * Item information and Memory management ' * (class memoryManager) ' * ' * sample code from ' * LotusScript to Lotus C API Programmer Guide by Normunds Kalnberzins, (c) 2000-2003 ' * ' * http://www.ls2capi.com ' * ' * Author: Normunds Kalnberzins ' * ' * This code has been written as a sample to illustrate aspects of handling of Lotus C API from LotusScript ' * and may be reused, modified on full responsibility of the developer and provided this notice is preserved ' * ' * The author does not guaranty it to fit any particular purpose and it is up to the developer ' * to modify, test it and determine the limits of its applicability ' * ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Public Class memoryManager OpenHandles List As Variant ' * * * * * * * * START (Method) [LOCKOBJECT] ' * * * * * * * * ' * ' * lock handle ' * Public Function LockObject (h) As Long If h=0 Then Exit Function LockObject = OSLockObject(h) Me.OpenHandles(h) = LockObject End Function ' * * * * * * * * END (Method) [LOCKOBJECT] ' * * * * * * * * ' * * * * * * * * START (Method) [UNLOCKOBJECT] ' * * * * * * * * ' * ' * unlock memory handle ' * Public Sub UnLockObject (h) ' * * * * * * * * begin auto-generated code ' * * * * * * * * Dim lnx_local_section As String on error goto ERR_THIS Dim lnx_local_error as String ' * * * * * * * * end auto-generated code ' * * * * * * * * If h=0 Then Exit Sub ' do not bite If Iselement(Me.OpenHandles(h)) Then OSUnLockObject(h) Erase Me.OpenHandles(h) End If ' * * * * * * * * begin auto-generated code ' * * * * * * * * EXIT_THIS: on error goto 0 Exit Sub ' * * * * * * * * Error Handling ' * * * * * * * * ERR_THIS: lnx_local_error = "Error in class: " &TypeName(Me) &" (" &lsi_info(2) &", called from:" &Lsi_info(12) &") " &lnx_local_section &":" & Error$ Print lnx_local_error Resume EXIT_THIS ' * * * * * * * * end auto-generated code ' * * * * * * * * End Sub ' * * * * * * * * END (Method) [UNLOCKOBJECT] ' * * * * * * * * ' * * * * * * * * START (Method) [UNLOCKALL] ' * * * * * * * * ' * ' * unlock all handles ' * Private Sub UnLockAll ' * * * * * * * * begin auto-generated code ' * * * * * * * * Dim lnx_local_section As String on error goto ERR_THIS Dim lnx_local_error as String ' * * * * * * * * end auto-generated code ' * * * * * * * * Forall hh In Me.OpenHandles Me.unlockObject hh End Forall ' * * * * * * * * begin auto-generated code ' * * * * * * * * EXIT_THIS: on error goto 0 Exit Sub ' * * * * * * * * Error Handling ' * * * * * * * * ERR_THIS: lnx_local_error = "Error in class: " &TypeName(Me) &" (" &lsi_info(2) &", called from:" &Lsi_info(12) &") " &lnx_local_section &":" & Error$ Print lnx_local_error Resume EXIT_THIS ' * * * * * * * * end auto-generated code ' * * * * * * * * End Sub ' * * * * * * * * END (Method) [UNLOCKALL] ' * * * * * * * * ' * * * * * * * * START (Method) [DELETE] ' * * * * * * * * ' * ' * triggers on Delete event ' * Public Sub Delete UnLockAll ' on delete release all locked handles End Sub ' * * * * * * * * END (Method) [DELETE] ' * * * * * * * * End Class' * memoryManager ' * * * * * * * * END (Class) [MEMORYMANAGER] ' * * * * * * * *