| View previous topic :: View next topic |
| Author |
Message |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Oct 10, 2002 9:36 am Post subject: Multiple instances |
|
|
This has probably allready been asked a zillion times but I can't find an answer in the archives so here goes;
How do I avoid the running of multiple instances of the same program? |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Oct 10, 2002 10:49 am Post subject: |
|
|
Give your program dialog a unique name, like:
| Code: | | DIALOG CREATE,"Jimjams1",.... |
Then at the very top of your script insert code to check for the existence of this program:
| Code: | if @winexists("Jimjams1")
EXIT
end |
Then your program will commit suicide if another instance of it is already running
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Oct 10, 2002 11:01 am Post subject: |
|
|
Yes, I thought of that too.
The problem is that the program is nested in the system tray (no window)
and is automatically started at logon.
I though about writing a statuscode during open and close to an Ini-file and than checking this code when the program is activated.
But that won't work either since the program is usually (not all the time!) closed at a windows shutdown. In that case no close-code will be written to the ini-file and the program won't start-up at the next logon.
any other ideas?  |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Oct 10, 2002 11:17 am Post subject: |
|
|
Even though your program has no window, just a task icon, you should be able to use this. If you
have a task icon, you have a dialog and can check for that.
Perhaps:
| Code: | if @winexists(#TJimjams1)
info Already running!
exit
end
dialog create,YourProgram,0,0,0,0,CLASS TJimjams1
dialog add,TASKICON,Tasker,,Test
dialog show
:Evloop
wait event
exit
|
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Jimjams Newbie

Joined: 23 Sep 2002 Posts: 21
|
Posted: Thu Oct 10, 2002 11:22 am Post subject: |
|
|
Thanks!
I'll give it a spin  |
|
| Back to top |
|
 |
|