Solved

Restarting Application

Posted on 2004-04-28
4
425 Views
Last Modified: 2010-04-05
How can i fully restart my application using simple code?
0
Comment
Question by:tomerlei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 25 total points
ID: 10938536
uses shellapi
procedure TForm1.Button1Click(Sender: TObject);
begin;
application.Terminate;
Shellexecute(0,'',PCHar(paramstr(0)),'','',sw_ShowNormal);
end;

or
uses windows

application.Terminate;
winexec(PCHar(paramstr(0)),sw_ShowNormal);
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10938541
uses ShellApi;

procedure AppRestart;
var AppName : PChar;
begin
  AppName := PChar(Application.ExeName) ;
  ShellExecute(Handle,'open', AppName, nil, nil, SW_SHOWNORMAL) ;
  Application.Terminate;
end;
0
 
LVL 17

Expert Comment

by:mokule
ID: 10939719
You should better use

  Application.Terminate;
  WinExec(CmdLine,SW_SHOWNORMAL);

which also passes command line parameters.
0
 
LVL 2

Expert Comment

by:-Karamja-
ID: 10941530
procedure TForm1.Button1Click(Sender: TObject);
var
  FullProgPath: PChar;
begin
  FullProgPath := PChar(Application.ExeName);
  WinExec(FullProgPath, SW_SHOW); // Or better use the CreateProcess function
  Application.Terminate; // or: Close;
end;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 73
Why can't I create any project with my delphi EXE file? 6 57
How to Get Images From Server using App Tethering 11 51
Firemonkey Queue list 1 50
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question