|
-
Nov 22nd, 2003, 05:35 PM
#1
Thread Starter
Addicted Member
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
-
Nov 23rd, 2003, 02:35 AM
#2
Frenzied Member
Read up on singleton design patterns.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Nov 23rd, 2003, 02:41 AM
#3
Thread Starter
Addicted Member
any link that you know....or any direction to go?
-
Nov 23rd, 2003, 06:49 PM
#4
Thread Starter
Addicted Member
Still wondering....
I have looked but still can not find any direction to go...
-
Nov 23rd, 2003, 07:29 PM
#5
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|