Login Register


[Source] Single instance app code filter_list
Author
Message
[Source] Single instance app code #1
Hi,

well, this isn't my creation, it is from web called: www.vbnet.cz

to find the whole thread click HERE (Note: The Language is Czech)

Okay, so, not much to tell about it... by using mutex, this will detect, if your application is already running or not. Simple as that Smile

Code:
Private appMutex As System.Threading.Mutex Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Form1.Load Dim createdNew As Boolean appMutex = New System.Threading.Mutex(False, "Unique mutex name", createdNew) If Not createdNew Then MessageBox.Show("Application is already running.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Application.Exit() End If End Sub
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: [Source] Single instance app code #2
The easier way is to check Make single Instance application in Project Properties.
But Mutex is good for CodeDom outputs and such. Nice share. Smile
[Image: rytwG00.png]
Redcat Revolution!

Reply







Users browsing this thread: 1 Guest(s)