Jump to content


Photo

Kill application, recompile and auto start in browser

kiill application start browser restart

  • Please log in to reply
12 replies to this topic

#1 NelsonFS

NelsonFS

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 87 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;


  • 4

#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
  • 497 posts
  • LocationAntalya / Turkey

Posted 26 January 2017 - 08:48 AM

thanks NelsonFS


  • 0

#4 quanliking

quanliking

    Newbie

  • uniGUI Subscriber
  • Pip
  • 6 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
  • 106 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
  • 3 posts

Posted 02 October 2017 - 06:38 AM

very good.thanks a lot.


  • 0

#7 chinacodegear@hotmail.com

chinacodegear@hotmail.com

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 11 December 2017 - 03:28 PM

my  project name is one8077 ,the exe is one8077.exe.

 

Why show "[Exec Error] The command "taskkill /F /IM one8077.exe /T" exited with code 128."?


  • 0

#8 rasaliad

rasaliad

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 106 posts
  • LocationRepublica Dominicana

Posted 12 December 2017 - 02:41 AM

my  project name is one8077 ,the exe is one8077.exe.

 

Why show "[Exec Error] The command "taskkill /F /IM one8077.exe /T" exited with code 128."?

Hi

 

En Project Options -> Build Events -> Pre-Build Events -> Cancel on Error = False.

 

 

 


  • 1

#9 Beginner

Beginner

    Active Member

  • Members
  • PipPipPip
  • 59 posts

Posted 08 January 2018 - 02:47 PM

Don't work taskkill  

What I'm doing wrong?

Rad 10.2.2


  • 0

#10 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3887 posts

Posted 09 January 2018 - 06:29 AM

Hi,

Which edition and build are you using?

Best regards,
  • 0

#11 Beginner

Beginner

    Active Member

  • Members
  • PipPipPip
  • 59 posts

Posted 09 January 2018 - 01:31 PM

Trial Edition

But another exe not unigui app i can't kill before compile

 

Sorry on Delphi Xe 3 Windows 7  work fine

But Delphi Rad Tokiyo 10.2.2  OS Windows 10 can't kill task by RAD 10.2.2 pre build command

if this command run cmd .exe   "taskkill /F /IM test.exe /T"  Tasks killed all


  • 0

#12 Freeman35

Freeman35

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 249 posts

Posted 10 January 2018 - 11:52 AM

Project options -> Build evebts -> Pre-Builds events -> Commands =

call C:\xxxxx\uniGUI.cmd $(OUTPUTFILENAME)

"uniGUI.cmd" text file in:

start taskkill /F /IM firefox.exe /T
start taskkill /F /IM %1 /T

  • 0

#13 Beginner

Beginner

    Active Member

  • Members
  • PipPipPip
  • 59 posts

Posted 12 January 2018 - 12:51 PM

I found what problem before run I need change something like move button or change caption like this

after that compilled and run task will kill..

 

In RAD XE3 work everytime when pushing RUN without changing something  but RAD Tokiyo  need change something before run second time


  • 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