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 / C++ / MFC
  4. One Istance of the application

One Istance of the application

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 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.
  • K Offline
    K Offline
    Kiran Pinjala
    wrote on last edited by
    #1

    I want only one instance of my application to run at a time. So i have creted a CSemaphore object with a name "app" in the global area. And in the Initinstance of the app class i am checking whether it is locked or not. if not locked, locking it and continue otherwise, return false. Its working fine. What i want to know is how can the CSemaphore object exists between the two different applications even when the application is closed? Thanks in advance for the reply.

    KIRAN PINJARLA

    G T 2 Replies Last reply
    0
    • K Kiran Pinjala

      I want only one instance of my application to run at a time. So i have creted a CSemaphore object with a name "app" in the global area. And in the Initinstance of the app class i am checking whether it is locked or not. if not locked, locking it and continue otherwise, return false. Its working fine. What i want to know is how can the CSemaphore object exists between the two different applications even when the application is closed? Thanks in advance for the reply.

      KIRAN PINJARLA

      G Offline
      G Offline
      GuyM
      wrote on last edited by
      #2

      The Semaphore is actually like a system-wide flag - it's handled by the OS. Once you create (and lock) the named semaphore from one instance of your application, Windows will not let you do that in the second instance ...

      K 1 Reply Last reply
      0
      • G GuyM

        The Semaphore is actually like a system-wide flag - it's handled by the OS. Once you create (and lock) the named semaphore from one instance of your application, Windows will not let you do that in the second instance ...

        K Offline
        K Offline
        Kiran Pinjala
        wrote on last edited by
        #3

        Thank you

        KIRAN PINJARLA

        1 Reply Last reply
        0
        • K Kiran Pinjala

          I want only one instance of my application to run at a time. So i have creted a CSemaphore object with a name "app" in the global area. And in the Initinstance of the app class i am checking whether it is locked or not. if not locked, locking it and continue otherwise, return false. Its working fine. What i want to know is how can the CSemaphore object exists between the two different applications even when the application is closed? Thanks in advance for the reply.

          KIRAN PINJARLA

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          for single instance my preference is alwways mutex due to memory overhead and other thing!

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

          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