Results 1 to 5 of 5

Thread: help....

  1. #1

    Thread Starter
    Addicted Member Stick's Avatar
    Join Date
    Aug 1999
    Location
    Iowa
    Posts
    152

    help....

    Is there a code that will only allow one instance of your app to be opened....




    Then when the code detects that another instance is running is there a way to pass the command line on to the already running instance.....


    What i have is my program opens a mp3 file when you double click on them....but when i click on a mp3 it opens my app and then i click on another mp3 it opens another one of my apps. So each time i click a mp3 i get a new app.

    Hope this makes sense.
    any help would bee great...
    Thanks

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Read up on singleton design patterns.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Addicted Member Stick's Avatar
    Join Date
    Aug 1999
    Location
    Iowa
    Posts
    152
    any link that you know....or any direction to go?

  4. #4

    Thread Starter
    Addicted Member Stick's Avatar
    Join Date
    Aug 1999
    Location
    Iowa
    Posts
    152

    Still wondering....

    I have looked but still can not find any direction to go...

  5. #5
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    This idea has been discussed many times. I think there is no flawless way of not letting another instance of application being run. What I used in my programs was creating a very strong named Mutex based on assembly GUID. Then trying to take the ownership of the mutex. If it failed it means that another instance has taken the ownership so this instance stopped running. But till now I haven't found a way to find the process that is taking the ownership of mutex, so that I can send parameters to that.

    Another way is to checking the pool of processes and see if a process with the same name as yours is running, if so you send the parameters to that process and quit this one. However it is not a guaranteed way.

    There is good thread about it in VBCity.
    http://www.vbcity.com/forums/topic.asp?tid=25500
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width