hm... good idea but.....
it sounds like You are working on a Mac...
there MC will only start once and it works - thats not the problem...
but on Windows you can start MC several times and so you can open a stack
several times
and you can´t trap this with an openstack handler!!!!
You have to know if in the Windows®-environment a second MC is running....

Regards,
          Ernst

> From: jbv <[EMAIL PROTECTED]>
> Subject: Re: MC on Windows and the same stack opened several times
> Date: Mon, 29 Jan 2001 10:32:33 +0000
> Kevin Miller  :
> > One way you could do it (any platform) is to create a "lock file" that
> > prevents multiple copies being run.  The idea is simple: on loading,
create
> > a text file in a specific place (e.g. the same directory as the stack).
On
> > closing, delete the file.  On startUp, if the file exists, put up an
error
> > message that the program is already running, and exit.
> But if your mc app runs from a CD-ROM, this solution might get a bit
> tricky...
> Why not use a global variable for each stack ? At startup you declare the
> variable and test its value. If the value is empty, that means the stack
opens
>
> for the 1st time. Then put "1" (or any other value) in the global.
> If global isn't empty, prompt an error message then exit.
> Further attempts to launch the same stack will result in error & exit.
>
> I don't have much programming experience with MC, but that's what I'd
> do in HC or OMO, so I guess it should work with MC too...
>
> Of course, the above solution implies that the MC stack remains open from
> the beginning to the end of a work session. If several different stacks
will
> open & close during a work session, and if you still want to prevent
multiple
> copies of each stck to run at the same time, then you'll have to set the
value
>
> of each global back to empty when closing each stack. This can be achieved
> with a "closestack" handler in which the global is set to empty.
> To prevent additional copies to set the global back to empty when closing,
> then you'll have to inhibit the closestack message for other copies of the
> same
> stack. This is easily done by putting a "set lockmessages to true" after
the
> error
> message.
>
> on openstack
>     global stackA
>     if stackA is not empty then
>         --prompt error message
>         set lockmessages to true
>         -- exit stack
>     else
>         put 1 into stackA
>     end if
> ...
>
>
> on closestack
>     global stackA
>     put "" into stackA
> ...
>
> Hope that helps.
>
> JB


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to