Option Strict On
Option Explicit On
Imports System.Reflection
Namespace My
Partial Friend Class MyApplication
#Region "Load Assembly Fields"
Private Sub AppStart(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf ResolveAssemblies
End Sub
Private Function ResolveAssemblies(ByVal sender As Object, ByVal e As System.ResolveEventArgs) As Reflection.Assembly
Dim desiredAssembly = New Reflection.AssemblyName(e.Name)
If desiredAssembly.Name = "BassLib" Then 'ระบุชื่อไฟล์ DLL.
Return Reflection.Assembly.Load(My.Resources.BassLib) 'ใส่ไฟล์ DLL ไว้ใน Resources.
Else
Return Nothing
End If
End Function
#End Region
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = False
Me.EnableVisualStyles = True
Me.SaveMySettingsOnExit = True
Me.ShutdownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.WindowsApplication1.Form1
End Sub
End Class
End Namespace