Показать сообщение отдельно
Старый 09.09.2004, 12:13     # 7
iam_xor
Junior Member
 
Аватар для iam_xor
 
Регистрация: 08.09.2004
Сообщения: 50

iam_xor Ушлепокiam_xor Ушлепок
Код:
Module MainModule
    Public app As New ApplicationContext()
    Public frm As New MainForm()

    Sub Main()
        Dim MutexCreated As Boolean
        Dim Mutex As System.Threading.Mutex
        Mutex = New System.Threading.Mutex(True, "Some_Fuckin_Instance", MutexCreated)
        If Not MutexCreated Then
            MessageBox.Show("Приложение уже запущено", "Бла Бла Бла", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Return
        End If

        app.MainForm = frm
        frm.Show()
        Application.Run(app)
        GC.KeepAlive(Mutex)
    end sub
end module
Фишка в том что GC тупо может порешить наш мьютекс и ему надо явно сказать чтобы он не трогал его

вот собсно и усё
iam_xor вне форума