How to avoid users to invoke an app (exe) already running

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

How to avoid users to invoke an app (exe) already running

Postby Edmilson Bringel » Sat Nov 29, 2008 10:39 am

Hi All,

I was thinking about to access the windows task manager and check about the image name at the proccess tab...but I don't know how to do that (which os call and the parameters...).
Any help (or other suggestion) will be very appreciated.

Thanks a lot!

Edi
Edmilson Bringel
 
Posts: 6
Joined: Sat Nov 24, 2007 8:26 am
Location: Brazil

Re: How to avoid users to invoke an app (exe) already running

Postby marten » Sat Nov 29, 2008 2:21 pm

If you are talking about VASMalltalk applications, I rename my "abt.exe" to the application name I wanted to have. Then I have "only" to query
the running process list if this application is running.

For that you must search the process list and for that you may look at: http://www.schrievkrom.de/blog/?p=229
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: How to avoid users to invoke an app (exe) already running

Postby koschate » Sun Nov 30, 2008 12:46 pm

I don't recall the implementation details exactly, but in the past I've done this by grabbing a system-level semaphore when the application is invoked. Subsequent attempts to invoke the application will fail as a result.
koschate
[|]
 
Posts: 102
Joined: Thu Feb 01, 2007 7:24 am

Re: How to avoid users to invoke an app (exe) already running

Postby nmongeau » Mon Dec 01, 2008 6:36 am

You can use this command-line argument:

-singleinstance
On Windows and OS/2, the -singleinstance option specifies that only a single instance of the associated executable can be running at the same time. Thus, specifying this option when you start the VA Smalltalk product executable abt.exe runs one instance of abt.exe and prevents you from running another instance of abt.exe at the same time.

Normand
nmongeau
[|]
 
Posts: 29
Joined: Fri Jan 12, 2007 9:37 am

Re: How to avoid users to invoke an app (exe) already running

Postby Michael Keppler » Wed Dec 10, 2008 5:21 am

All those solutions (except for the semaphore) don' really help. You can easily copy/paste/rename the executable and run a second instance that way. To check whether another instance is already running, I suggest to create a mutex with a known name and check if that operation worked (there was no mutex with the same name, so also no other instance) or not (other instance with same mutex name already running).

see
Code: Select all
OSSecurityAttributes>>#createMutex:lpszMutexName:


For more documentation, see MSDN.
Michael Keppler
 
Posts: 28
Joined: Wed Feb 27, 2008 4:33 am


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest