[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Restarting Application

Posted on 2004-04-28
4
Medium Priority
?
433 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 23

Accepted Solution

by:
Ferruccio Accalai earned 100 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 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