Page 1 of 1

Trayapp should stay in tray when preventing second instance

PostPosted: Wed Sep 15, 2010 1:10 am
by HPW
I have a tray app which is also set to 'only run once'.
When I start it first the app minmize to the tray correctly.
When I start it a second time, the second instance is prevented,
but the first instance open its window and its button in taskbar.

Starting the second unwanted instance should not make the first instance appear.

PostPosted: Wed Sep 15, 2010 10:11 am
by Neosoft Support
Starting the second unwanted instance should not make the first instance appear.


I'm not sure. Wouldn't someone attempting to run a second copy indicate that they've forgotten that the app was already running or that they wanted to use it? To override this behavior you could try this:

You can detect when a user attempts to launch a second instance of your publication by creating a special subroutine called CommandLine_OnChange. NeoBook will automatically execute this subroutine whenever the user attempts to start more than one copy of your publication. For example:

:CommandLine_OnChange
SetVar "[WindowState]" "Minimize"
Return

PostPosted: Wed Sep 15, 2010 12:47 pm
by HPW
After correcting the typo it works somehow.

Code: Select all
:CommandLine_OnChange
SetVar "[WindowState]" "Minimized"
Return


It still show up a short time and then disappear into tray.
Thanks for the tip.