Prevent multiple instances of a PHAR-LAP DOS EXTENDER program 
Author Message
 Prevent multiple instances of a PHAR-LAP DOS EXTENDER program

We us PharLap as our ASM of choice because of its DOS extenders

but with the advent of Win95/98  our users are now moving from all DOS PCs
to hybrids

the major problem we are having is that our users are messing with windows
while waiting for
customers, and then when customers show up, they double click the program
icon and begin
yet another instance of the program. I have had users who call up and say
the program is no
longer working only to find that the program still works but the program
that is doing the work
is like number 20 out of 50 running programs.

With Phar-Lap's TNT DOS-Extender I would like to be able to when the user
double clicks the
program icon to have the program check to see if it is running and just
bring up the running program
or pass a window that gives the user the option of Y/N do you want another
instance of this program
running

keep in mind that with the DOS Extender the program thinks it is running on
its own PC and any other
instances of this program running thinks its also on separate PCs and cannot
see the other program running

- at least this is what I THINK the case to be.

any help would be appreciated

Kurt



Mon, 31 Dec 2001 03:00:00 GMT  
 Prevent multiple instances of a PHAR-LAP DOS EXTENDER program

Hi Kurt,

[snip]

Quote:
> the major problem we are having is that our users are messing
> with windows while waiting for customers, and then when
> customers show up, they double click the program icon and begin
> yet another instance of the program. I have had users who call up
> and say the program is no longer working only to find that the
> program still works but the program that is doing the work is like
> number 20 out of 50 running programs.

> With Phar-Lap's TNT DOS-Extender I would like to be able to
> when the user double clicks the program icon to have the program
> check to see if it is running and just bring up the running program
> or pass a window that gives the user the option of Y/N do you want
> another instance of this program running

[snip]

Quote:
> - at least this is what I THINK the case to be.

    Even if the senario you've described isn't happening, it's one
worth preventing.  The best solution I can come up with has the
program using an .INI file (or another entry if it already has one).

    Every time the program is opened it checks the .INI file for an
entry called (strangely enough ;-)) "AlreadyRunning=X".
If (X > 0)
    {
    display "Do you wish to start another instance ? (Y/N)"
    if (N) terminate.
    }
increment X, and write it to the .INI file
run the program as normal.
upon termination, read X from the .INI, decrement X, and
write it back to the .INI file.

    Two potential problems with the above solution:-
- If the machine is reset before the program is closed, it'll
lose track of the number of "running" copies.  This isn't a
enormous problem, but it could confuse some. It could
easily be fixed by one competent person with a text editor,
but can you assume there's such a person present?
- I don't know of an easy way to get the second, or
subsequent, instance to "bring up" the existing instance.

Quote:
> any help would be appreciated

> Kurt

I hope this helps some.

-Brent



Tue, 01 Jan 2002 03:00:00 GMT  
 Prevent multiple instances of a PHAR-LAP DOS EXTENDER program
How about writing a small SDI/MDI Win32 app which just
invokes the TNT-DOS app?  

An SDI app will not start a new instance, so if this invoker
spawns a child and waits for it's exit, then it is still around
until the TNT-DOS app has exitted.

An MDI app can have multiple instances, but then you can
"look" for other copies of it running and ask you question
(this will be harder).

I am not an expert at Win32 stuff, so I can't add more than
that.  HIH
--
Kevin G. Rhoads, Ph.D. (Linearity is a convenient fiction.)




Tue, 01 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help needed with Phar-Lap DOS Extender.

2. lahey/phar lap dos-extender help needed

3. Phar lap Dos extender ???

4. Running a Phar-Lap extended DOS (MS PS Fortran) App

5. Powerstation Fortran and the Phar Lap Linker

6. Python on Phar Lap ETS (RTOS) - Success!

7. preventing multiple instances of a 32 bit app

8. preventing multiple instances of the same menu item

9. Prevent multiple instances

10. Preventing Multiple VO Application Instances.

11. Windows mutex to prevent multiple instances

12. Help! Preventing multiple instances

 

 
Powered by phpBB® Forum Software