TTMSFNCCloudStorageServices waiting for upload ending

Good morning to all,
i have one more question about TTMSFNCCloudStorageServices.
Considering that upload, download and file list are Asynchronous procedures there are a possibility to run one of them NOT asynchronous ?
I try to explain better.
Here a piece of my procedure

    EndUpLoad:=False;
    CloudProgress.Position:=0; // Progres bar position
    CloudStorage.Upload(CurrentFolder, CloudFileName); // Starting upload
    PreviousTickCount:=GetTickCount; // Your suggestion ..
    // I need to stay here until the upload is ended 
    // at the moment i'm using this but .... is not so "safe"
    repeat
      Application.ProcessMessages;
    until EndUpload

EndUpolad is setted here..... when upload is finished ..

procedure TCloudForm.CloudStorageUploadFile(Sender: TObject;
  const AUploadItem: TTMSFNCCloudItem;
  const ARequestResult: TTMSFNCCloudBaseRequestResult);
begin
  EndUpload:=True;
end;

But there some problems ....
One of them is the use of Application.ProcessMessages used, not only to wait upload process, to get the "Cancell" button click in order to stop the upload procedure; Anyway i prefer not use Application.ProcessMessages.
Exist onother way do this "job" ??

While upload is in progress, there's a way to get, if exists, any error message?? (sometime, very often .. meaning 6 time on 10, the upload ending BEFORE all file is uploaded; But i do not why).

Thank's for the attention

Regards
Daniele

Hi,

There is currently no way around this. The upload process is asynchronous. If you want to wait, you should at least introduce a sleep in between Application.ProcessMessage calls to avoid the main thread from locking up:

   repeat
      Sleep(100);
      Application.ProcessMessages;
    until EndUpload;

Hi Pieter,
thank's for your reply....
I inserted the sleep and, seem, the "out of system resources" message no more happend ...
I'll keep you informed ...

Regards
Daniele