autoupgrader OnLostFile event
Return to Introduction  Previous page  Next page
Applies to
auAutoUpgrader component.  

  TauAULostFileEvent = procedure(Sender: TObject; FileURL: String; ErrorCode: Integer; var ContinueUpgrade: Boolean) of object;  
property OnLostFile: TauAULostFileEvent;  

The OnLostFile event occurs if some file, of that which listed in the downloaded Info-file, can not be downloaded by specified URL (error code has received in the response header from HTTP server).  
Most common error reason is HTTP error #404 (document not found), but please check out all HTTP status codes for more information about HTTP errors.  
The AutoUpgrader passes following parameters to the OnLostFile event handler:  
FileURLthe Internet address of the file which we just tryed to download;  
ErrorCodeinteger number which identifies the HTTP error (see the list of HTTP Status Codes to recognize an error).;  
ContinueUpgradeset this flag variable to True if you wish to skipinaccessible file and still continue the upgrade.  
tip The AutoUpgrader have the standard dialog box, destined to notify user about this event. If you wish to show this message automatically (in native user's language, specified in Language property), set mLostFile flag of ShowMessages property to True, or otherwise, set it to False if don't want to display this message automatically.  

procedure TForm1.auAutoUpgrader1LostFile(Sender: TObject;  
  FileURL: string; ErrorCode: Integer;  
  var ContinueUpgrade: Boolean);  
  ContinueUpgrade := Application.MessageBox(PChar('File "' + FileURL + '" not found or inaccessible.'#13#13'Try to skip this file and continue upgrade?'),  
    PChar('Error #' + IntToStr(ErrorCode)),  

C++ Builder:

void __fastcall TForm1::auAutoUpgrader1LostFile(TObject *Sender,  
      AnsiString FileURL, int ErrorCode, bool &ContinueUpgrade)  
  AnsiString Msg  =  
      "File \'" + FileURL + "\' not found or inaccessible.\n\n"  
      "Try to skip this file and continue upgrade?";  
  AnsiString Capt =  
      "Error #" + IntToStr(ErrorCode);  
  ContinueUpgrade = Application->MessageBox(Msg.c_str(),  
        Capt.c_str(), MB_YESNO | MB_ICONWARNING) == ID_YES;  

See also

ShowMessages property;  
Info-file example; HTTP Status Codes.