SergioFeitoza Posted June 29, 2020 Share Posted June 29, 2020 Suppose I am going to RUN my code and did run it just before. Is there a way of , before doing anything, to shutdown the previous “run” ? . I imagine that there is some property thats enable to do this automatically (if it is the same exe) instead of going manually one by one Quote Link to comment Share on other sites More sharing options...
mierlp Posted June 29, 2020 Share Posted June 29, 2020 I use the code below in the servermodule (thanks to d.bernaert) procedure ExploreWeb(page:PChar); begin ShellExecute(0, 'open', page, nil, nil, 1); end; procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); begin if ExtractFileExt(ExtractFileName(ParamStr(0)))='.exe' then ExploreWeb(pchar('http://localhost:'+ IntToStr(port))); end; Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted June 29, 2020 Author Share Posted June 29, 2020 Thank you very much Mierlp. I use something more or less like this but to connect directly without typing C;//localhost:8077 . I wil try to do it an will inform here Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted June 29, 2020 Author Share Posted June 29, 2020 Just now, mierlp said: I use the code below in the servermodule (thanks to d.bernaert) procedure ExploreWeb(page:PChar); begin ShellExecute(0, 'open', page, nil, nil, 1); end; procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); begin if ExtractFileExt(ExtractFileName(ParamStr(0)))='.exe' then ExploreWeb(pchar('http://localhost:'+ IntToStr(port))); end; Thank you very much Mierlp. I use something more or less like this but to connect directly without typing C;//localhost:8077 . I wil try to do it an will inform here Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted June 29, 2020 Author Share Posted June 29, 2020 8 minutes ago, SergioFeitoza said: Thank you very much Mierlp. I use something more or less like this but to connect directly without typing C;//localhost:8077 . I wil try to do it an will inform here Hi . I did some tests and I think it was improved but not solved. Befire I had several instances open and now, after doing what you suggested, it seems I have just one A doubt I alwais have is why when I ask to close I always have to close manually (see the figure) "as in the message "Just Close The TAB" I think I should include in the event OnBeforeShutDown of the ServerModule some code that makes "Close the Tab". The problem is that I do not know what to include Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted June 29, 2020 Author Share Posted June 29, 2020 Just now, SergioFeitoza said: Hi . I did some tests and I think it was improved but not solved. Befire I had several instances open and now, after doing what you suggested, it seems I have just one A doubt I alwais have is why when I ask to close I always have to close manually (see the figure) "as in the message "Just Close The TAB" I think I should include in the event OnBeforeShutDown of the ServerModule some code that makes "Close the Tab". The problem is that I do not know what to include Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 29, 2020 Share Posted June 29, 2020 44 minutes ago, SergioFeitoza said: I think I should include in the event OnBeforeShutDown of the ServerModule some code that makes "Close the Tab". The problem is that I do not know what to include It's impossible... Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted June 30, 2020 Share Posted June 30, 2020 Use KILL before run in Delphi IDE Project Options What you see in browser is just the result of a ServerStandAlone. Closing tab , won't close the server, hence app still running. Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted June 30, 2020 Author Share Posted June 30, 2020 17 minutes ago, Fred Montier said: Use KILL before run in Delphi IDE Project Options What you see in browser is just the result of a ServerStandAlone. Closing tab , won't close the server, hence app still running. Hi Fred. Thank you very much. When I saw your comment I did remeber this post http://forums.unigui.com/index.php?/topic/3511-kill-application-recompile-and-auto-start-in-browser/ Actually I have implemented it before but instead of writing taskkill /F /IM SWDweb.exe (name of APP = SWDweb.exe) I wrote taskkill /F /IM program.exe I will do some tests here with this line By the way, is it possible to write this command in such a way that it close that active running code, indeoendent of the name ?? something like taskkill /F /IM anyName.exe I noticed that when I run my App and CLOSE it. The Login Page remains opened in the browser. Is there a way to close it automatically ? Is this caused by "Remember my Login" ? Quote Link to comment Share on other sites More sharing options...
zhyhero Posted June 30, 2020 Share Posted June 30, 2020 just an idea. 1.get you app's PID 2 find same exename process's PIDs 3 kill PIDs all....... Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted June 30, 2020 Author Share Posted June 30, 2020 Just now, zhyhero said: just an idea. 1.get you app's PID 2 find same exename process's PIDs 3 kill PIDs all....... Thanks zhyhero I will check if it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.