Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Application.Exit()

Application.Exit()

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ASysSolvers
    wrote on last edited by
    #1

    In my application I have restricted to the 2nd instant of application giving below code, s_Mutex = new Mutex(true, "MyApp"); if (s_Mutex.WaitOne(0, false)) { Application.Run(new frmSocket()); } else { MessageBox.Show("Another instance is running"); } Also im using a Logoff button in my application and and have used below code, System.Windows.Forms.Application.Exit(); System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); Problem when I press log off button it cause to 2nd instant ans show the message ("Another instance is running") I want to run appication again beeing restricting 2nd instant. How ovecome that issue.

    G 1 Reply Last reply
    0
    • A ASysSolvers

      In my application I have restricted to the 2nd instant of application giving below code, s_Mutex = new Mutex(true, "MyApp"); if (s_Mutex.WaitOne(0, false)) { Application.Run(new frmSocket()); } else { MessageBox.Show("Another instance is running"); } Also im using a Logoff button in my application and and have used below code, System.Windows.Forms.Application.Exit(); System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); Problem when I press log off button it cause to 2nd instant ans show the message ("Another instance is running") I want to run appication again beeing restricting 2nd instant. How ovecome that issue.

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      You need to close mutex when you no longer need it. Making the Application Single-instance[^]

      Giorgi Dalakishvili #region signature my articles #endregion

      A 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        You need to close mutex when you no longer need it. Making the Application Single-instance[^]

        Giorgi Dalakishvili #region signature my articles #endregion

        A Offline
        A Offline
        ASysSolvers
        wrote on last edited by
        #3

        Thankz Lot... i used, s_Mutex.Close() after Application.Run(.... statement Grate!!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups