/Source Code/PowerSong/ApplicationEvents.vb

# · Visual Basic · 26 lines · 15 code · 9 blank · 2 comment · 0 complexity · 40b0a253332201fca5c21e034e30cde0 MD5 · raw file

  1. Namespace My
  2. Partial Friend Class MyApplication
  3. Private Sub MyApplication_StartupNextInstance(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
  4. ' Bring to foreground
  5. e.BringToForeground = True
  6. ' Check if a file needs to be opened
  7. If e.CommandLine.Count > 0 Then
  8. Dim FileName As String = e.CommandLine.Item(0)
  9. LoadExternalFile(FileName)
  10. End If
  11. End Sub
  12. Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
  13. Call (New frmException(e.Exception)).ShowDialog()
  14. e.ExitApplication = False
  15. End Sub
  16. End Class
  17. End Namespace