Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Dear,

 

Can u please tell me on how to do this:

 

I have a project and after distribute to the user side, i want to limit the user to only open the program once in a time.

 

if the user click on the exe file, the system will check whether the program has been opened. if it is opened, the system will say "You are not allow to run two at once"

 

Thanks in advance, I am looking for this solution urgently. please help.

George C.K. Low

  • Administrators
Posted

Put the following in either your Sub Main of the Form_Load event of your 1st Form

Dim running As Boolean
Dim mut As New System.Threading.Mutex(True, Application.ProductName, running)

If running = False Then
      MessageBox.Show("Already running")
      Me.Close()
End If

 

should work fine

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...