Jump to content

ShutDown previous runnings automatically


SergioFeitoza

Recommended Posts

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

ShutDown.png

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

CloseAll.png

Link to comment
Share on other sites

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" ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...