How to download and execute application from URL

Up to version Delphi 2007 works this code:

URLDownloadToFile(nil, PChar(‘www.test.com\test.exe’), PChar(‘d:\dir\test.exe’), 0, nil);
WinExec(PChar(‘d:\dir\test.exe’),SW_NORMAL);

After Delphi 2007 procedures for executin file is changed to:

ShellExecute(self.WindowHandle,’open’,pchar(‘d:\dir\test.exe’),nil,nil, SW_SHOWNORMAL);

Leave a Reply

Your email address will not be published. Required fields are marked *