Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 4 Monaten
Letzter Beitrag:
vor 3 Monaten, 4 Wochen
Beteiligte Autoren:
Curtis, Fabrice Harari, iso, Ned!

[WD20] Avoiding "This application cannot be launched several times." [SOLVED]

Startbeitrag von Curtis am 11.08.2017 17:49


Cette application ne peut pas etre lancee plusieurs fois.
This application cannot be launched several times.


I'm trying to avoid the above error. It happens when I exit my app, and try to relaunch it right away. It seems my app is taking some time to completely stop running.

To exit the app I use EndProgram(). The only closing code that runs is disconnecting 3 or 4 serial connections and closing an extra sister window that displays on a different monitor. I just commented out the closing code and generated a new exe. I still have the same problem.

Any suggestions?

Antworten:

Re: [WD20] Avoiding "This application cannot be launched several times."

Hiya, when you re creating the exe isn't there an option saying something like, 'only allow one instance to be running at once' maybe you have that ticked? As I have no problems running multiple instances of the same exe.

ISO

von iso - am 11.08.2017 19:52

Re: [WD20] Avoiding "This application cannot be launched several times."

That is correct. However I would like to continue to disallow our users from opening multiple instances.

von Curtis - am 11.08.2017 19:57

Re: [WD20] Avoiding "This application cannot be launched several times."

Hi Curtis,

Set the project to allow 'multiple instances' to run - and then use the code in the project opening event to control the number of instances allowed and the message that is given to the user.


IF ExeRunning() > 1 THEN
Info("Only one instance of the application can be run at a time.")
EndProgram(True)
END


Thanks
Ned!

von Ned! - am 14.08.2017 08:48

Re: [WD20] Avoiding "This application cannot be launched several times."

Hi Curtis,

here is no way to avoid that problem completely, as you are saying that you are trying to relaunch the app BEFORE it is completely unloaded.

But maybe you can mitigate the problem by first opening a "Wait, closing operations in process..." free window with no code in it and by closing that window as the last line of project closing code (Not sure it will work)

A more complex solution would be to have a secondary exe that you run first (and that exe displays the message). In it a timer checks in memory is the main exe is still there and closes itself only when it's not anymore. At that point, the user can restart the program.

Of course, the user can still start the program too early, but there is a window right there to tell him that he is a dummy :-)

Best regards

von Fabrice Harari - am 14.08.2017 13:13

Re: [WD20] Avoiding "This application cannot be launched several times."

Thanks y'all! I'm going to go with Ned's solution.

von Curtis - am 14.08.2017 15:45
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.