FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WD20] Avoiding "This application cannot be launched several times."
[WD20] Avoiding "This application cannot be launched several times."
Débuté par Curtis, 11 aoû. 2017 19:49 - 5 réponses
Connectez-vous…
Curtis
#1
Posté le 11 août 2017 - 19: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?
Signaler
0
0
iso
#2
Posté le 11 août 2017 - 21:52
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
Signaler
0
0
Curtis
#3
Posté le 11 août 2017 - 21:57
That is correct. However I would like to continue to disallow our users from opening multiple instances.
Signaler
0
0
Ned!
#4
Posté le 14 août 2017 - 10:48
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!
Signaler
0
0
Fabrice Harari
#5
Posté le 14 août 2017 - 15:13
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
Signaler
0
0
Curtis
#6
Posté le 14 août 2017 - 17:45
Thanks y'all! I'm going to go with Ned's solution.
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte