Jump to content


Photo

Kill application, recompile and auto start in browser

kiill application start browser restart

  • Please log in to reply
5 replies to this topic

#1 NelsonFS

NelsonFS

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 86 posts

Posted 06 October 2013 - 02:35 PM

Hi,

 

Everytime we recompile application, you must close in traybar and refresh browser page.

The tip will automatically close application and start a new page in default browser.

 

In Project, Options, Build Events,Pre-Build, write command:

  taskkill /F /IM program.exe /T

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
  if self.StandAloneServer then //if you need this, if not, remove it.
    ExploreWeb('http://localhost:8077'); //auto start browser
end;

procedure ExploreWeb(page:PChar);
var Returnvalue: integer;
begin
  ReturnValue := ShellExecute(0, 'open', page, nil, nil,SW_SHOWNORMAL);
  if ReturnValue <= 32 then
     begin
     case Returnvalue of
          0 : MessageBox(0,'Error: Out of memory','Error',0);
          ERROR_FILE_NOT_FOUND: MessageBox(0,'Error: File not found','Error',0);
          ERROR_PATH_NOT_FOUND: MessageBox(0,'Error: Directory not found','Error',0);
          ERROR_BAD_FORMAT    : MessageBox(0,'Error: Wrong format in EXE','Error',0);
     else
          MessageBox(0,PChar('Error Nr: '+IntToStr(Returnvalue)+' inShellExecute'),'Error',0)
     end;
  end;
end;

 

procedure TFMainForm.UniFormShow(Sender: TObject);
begin

    //show frame/form to login only if we are not debuging...

    if  (DebugHook = 0) then
    begin
      FLogin.ShowModal;

     ...

    end;

end;


  • 3

#2 fredmontier

fredmontier

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 25 January 2017 - 11:54 PM

:D Saves me a lot of time from now on.... thanks a lot !


  • 0

#3 _Mehmet_

_Mehmet_

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 486 posts
  • LocationAntalya / Turkey

Posted 26 January 2017 - 08:48 AM

thanks NelsonFS


  • 0

#4 quanliking

quanliking

    Newbie

  • uniGUI Subscriber
  • Pip
  • 3 posts
  • LocationYueqing city, zhejiang province NingKang east road no. 98

Posted 04 February 2017 - 01:28 PM

It is time-saving, thanks NelsonFS.


  • 0

#5 rasaliad

rasaliad

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 104 posts
  • LocationRepublica Dominicana

Posted 04 February 2017 - 02:11 PM

Hi NelsonFS

 

Yes it is fantastic!!!!!


  • 0

#6 chinacodegear@hotmail.com

chinacodegear@hotmail.com

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 02 October 2017 - 06:38 AM

very good.thanks a lot.


  • 0





Also tagged with one or more of these keywords: kiill, application, start, browser, restart

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users