Example

This event procedure is triggered after a settings file is opened. It creates a log file with the name of the settings file opened, the time and date the file was opened, and the type of settings file that was opened.

Note: This procedure will log the opening of any complete settings file that contains this code, and will log the opening of any partial settings file if the currently open settings file contains this code.

Private Sub Session_AfterLoadSettings(ByVal SettingsFileName As String, ByVal SettingsType As Long)

 

 Dim settingsTypeString As String 'Settings type description

 

 'Convert SettingsType argument to descriptive string

 Select Case SettingsType

  Case rcSettings

   settingsTypeString = "Complete settings"

  Case rcColors

    settingsTypeString = "Color settings"

  Case rcConnection

    settingsTypeString = "Connection settings"

  Case rcHotspots

    settingsTypeString = "Hotspot settings"

  Case rcKeymap

    settingsTypeString = "Keymap settings"

  Case rcMenumap

    settingsTypeString = "Menu settings"

  Case rcToolbar

    settingsTypeString = "Toolbar settings"

 End Select

  

 

 'Write data to the log file

 Open "C:\mypath\myfile.txt" For Append As #1

 Print #1, SettingsFileName, Time, Date, settingsTypeString

 Close #1

End Sub