Go to Post Bottom line: hobbiests, hackers, and tinkerers can fiddle with something and make it work. Engineers are people who [b]engineer[/b] solutions to problems. - Dave Flowerday [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 01-02-2008, 12:30
FaNIX FaNIX is offline
Registered User
no team
 
Join Date: Feb 2008
Location: sa
Posts: 1
FaNIX is an unknown quantity at this point
Restarting Main Application in TThread Class

Hi People,

I am trying to restart my Main Application by using code inside a Thread. Basicly my restart function works 100% when placed inside the Main Application code. But since a TThread runs in another memory space, i think reference to the Application.Terminate is not set to the Main Application, maybe to the thread, I don't know.

Here is my restart procedure inside my Thread:

Quote:
procedure TUpdateLibThread.AppRestart;
var
HANDLE : HWND;
begin
ShellExecute(HANDLE,'open',Application.ExeName, '', '', 1) ;
Application.Terminate;
end;
The thread is called by die main application, but the restart application must be inside the thread, as the outcome of the thread determines if the application should be restarted or not. If there is a way to return a value back to the main application when the thread ends, then i might be able to use that to determine if i need to call the restart procedure...

Help?
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
changing main.c 3dude_2231 Programming 15 21-02-2007 01:54
main.c 6600gt Programming 3 29-08-2006 02:19
Editing Main.c Astronouth7303 Programming 22 20-02-2004 16:45
Main Stage archiver 2001 3 24-06-2002 03:06
main driver Kaitlin Palmer Off-Season Events 0 09-04-2002 21:26


All times are GMT -5. The time now is 23:53.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi