forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Multiple instances

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Oct 10, 2002 9:36 am    Post subject: Multiple instances Reply with quote

This has probably allready been asked a zillion times but I can't find an answer in the archives so here goes; Confused

How do I avoid the running of multiple instances of the same program?
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Oct 10, 2002 10:49 am    Post subject: Reply with quote

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 Wink

Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Oct 10, 2002 11:01 am    Post subject: Reply with quote

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? Confused
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Oct 10, 2002 11:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Jimjams
Newbie


Joined: 23 Sep 2002
Posts: 21

PostPosted: Thu Oct 10, 2002 11:22 am    Post subject: Reply with quote

Thanks!

I'll give it a spin Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group