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:
Delphi-Quellcode:
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?