VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "StackTrace" Attribute VB_GlobalNameSpace = True Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit 'NOTE: The purpose of the Initialize method in StackTrace isn´t immediately obvious, 'since the Err object is a global variable. However, it appears that the client and server 'components do not share the same Err object, so, for example, assigning to Err.Number 'in one component doesn´t affect the value in the other component. Consequently, we 'need to make sure it´s the client´s Err object we´re checking in CTracker´s Terminate 'event. To make things even more confusing, Err does behave like a shared variable 'when you run these components together in a project group. If in doubt, 'debug your components the old way, using separate instances of Visual Basic 'for the client and server. Public Sub Initialize(ByVal ErrorObject As ErrObject) Set GStacker.ClientErrObject = ErrorObject If RegOptions.DebugTrace Then GStacker.Tracing = True End If End Sub Public Function Enter(ModuleName As String, _ ProcName As String) As Tracker Set Enter = New Tracker Enter.Module = ModuleName Enter.Proc = ProcName If GStacker.Tracing Then GStacker.TraceMsg "Enter: " & ModuleName & "." & ProcName & SysResourcesGetWorkingSet End If End Function Public Sub Report(ModuleName As String, _ ProcName As String) GStacker.Report ModuleName, ProcName Me.Clear End Sub Public Sub Clear() GStacker.Clear End Sub ' Works best like this if the error handling is in a seperate DLL ' For internal use we have an quivalent in GStacker.bas Public Property Get GStackTrace() As StackTrace Set GStackTrace = Me End Property