1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Imports System.Threading
Imports System.IO
Friend Class Program
<STAThread()>
Public Shared Sub Main(Args$())
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Dim instanceCountOne As Boolean = False
Using mtex As Mutex = New Mutex(True, Application.ProductName, instanceCountOne)
If instanceCountOne Then
If OSIs64bit()
ExtractFileFromResource(Application.StartupPath & "\SQLite.Interop.dll", My.Resources.SQLite_Interop64_dll)
Else
ExtractFileFromResource(Application.StartupPath & "\SQLite.Interop.dll", My.Resources.SQLite_Interop86_dll)
End If
Application.Run(New Frm_Main)
mtex.ReleaseMutex()
End If
End Using
End Sub
End Class
Private Shared Sub ExtractFileFromResource(FilePath As String, ResName As Byte())
If Not File.Exists(FilePath) Then
System.IO.File.WriteAllBytes(FilePath, ResName)
End If
End Sub
Private Shared Function OSIs64bit() As Boolean
Try
If (Environment.GetEnvironmentVariable("ProgramFiles(x86)") <> "") Then
Return True
End If
Catch ex As Exception
End Try
Return False
End Function |
Partager