Jump to content

"Make single instance application"


a3deluxe
 Share

Go to solution Solved by a3deluxe,

Recommended Posts

Olá,

Precisava de uma simples ajuda, que não estou a conseguir resolver que é:

1- Na minha aplicação (APP1.exe) coloco nas propriedades Make single instance application

para quando abrir várias vezes a aplicação ela só abrir uma vez no Taskbar.

2- Copio a mesma aplicação e altero algum código e mudo o nome para (APP2.exe) e volto a compilar com o

Make single instance application, mas desta vez não funciona, quando abro varias vez, ele abre várias aplicações no TaskBar.

O que posso fazer?

Obrigado

Link to comment
Share on other sites

  • Solution

Resolvido assim:

// 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       objMutex = New Mutex(False, "SINGLE_INSTANCE_APP_MUTEX")
       If objMutex.WaitOne(0, False) = False Then
           objMutex.Close()
           objMutex = Nothing
               End
       End If
       End Sub    

Obrigado,pela ajuda.

Edited by a3deluxe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.