Implementing an OnMdbStartup Event Sink
Topic Last Modified: 2006-06-12
The following code handles and logs the OnMdbStartup system event. See Store Event Sink Bit Flags for more information.
Example
Visual Basic
Private Sub IExStoreSystemEvents_OnMDBStartUp(ByVal bstrMDBGuid As String, ByVal bstrMDBName As String, ByVal lFlags As Long)
Dim FSO As Object
Dim EvtLog As String
Dim EvtFile
'Log file
EvtLog = Environ("SystemDrive") & "\OnMDBStartUp.log"
'Creates new log file %SystemDrive%\OnMDBStartUp.log or opens it if exists
Set FSO = CreateObject("Scripting.FileSystemObject")
Set EvtFile = FSO.OpenTextFile(EvtLog, 8, True)
'Append incoming event info into log file
EvtFile.WriteLine ("[VB Event Sink] OnMDBStartUp()")
EvtFile.WriteLine (" MDB Guid " & bstrMDBGuid)
EvtFile.WriteLine (" MDB Name " & bstrMDBName)
EvtFile.WriteLine (" lFlags: " & "0x" & Hex(lFlags))
EvtFile.WriteBlankLines (1)
'Before Quit
EvtFile.Close
Set FSO = Nothing
End Sub