Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[VB2010] Program already running

$
0
0
I want my program to be single-instance. So my goal is to detect if the program (installed in the x86 Program Files folder) is already running and inform of the fact with a message the PC user.

The code :

Code:

        If Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1 Then
            MessageBox.Show("The program is already running!!", " Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Me.Close()
        End If

Works fine, BUT THERE IS A PROBLEM.

In effect I want that EVERY USER OF THE SAME PC can run the program only once... but with the above code if a PC user runs the program without to close it and then another PC User logs the PC... if he runs the program is displayed the above message: he can't run the program if the program itself is opened from another PC user.

How to make the program at single istance for every user of the same PC?

Ty :)

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>