델파이 2010버전에서
urlDownloadToFile을 이용하여 http 서버에 있는 파일을 다운로드하는 프로그램입니다.
궁금한 것은 프로그레스바에서 진행상태를 보여줘야 되는데
중간에 진행되는 상황은 보이지 않고, 마지막에서만 보여집니다.
Application.ProcessMessages가 있는데도 않됩니다.
아래는 해당부분 소스입니다.
<!--CodeS-->
function         TMyStatus.OnProgress(ulProgress, ulProgressMax, ulStatusCode :ULONG; szStatusText :LPCWSTR) : HResult; StdCall;
var
  BindStatus  : String;
begin
  case  ulStatusCode  of
    1 : BindStatus  :=  '1 : Finding Resource';
    2 : BindStatus  :=  '2 : Connecting';
    3 : BindStatus  :=  '3 : Redirecting';
    4 : BindStatus  :=  '4 : Begin Download Data';
    5 : BindStatus  :=  '5 : Downloading Data';
    6 : BindStatus  :=  '6 : End Download Data';
    7 : BindStatus  :=  '7 : Begin Download Components';
    8 : BindStatus  :=  '8 : Installing Components';
    9 : BindStatus  :=  '9 : End Download Components';
   10 : BindStatus  :=  '10 : Using Cached Copy';
   11 : BindStatus  :=  '11 : Sending Request';
   12 : BindStatus  :=  '12 : CLASSID Available';
   13 : BindStatus  :=  '13 : MIMEType Available';
   14 : BindStatus  :=  '14 : Cache Filename Available';
  end;
        if        Assigned(frmUpdateHttp)        then
                begin
      if  FileSizeTotal <>  0 then
        begin
          if  ulStatusCode  = 5 then  //  데이터 다운로드 중
            begin
              FileSizeCurrent :=  FileSizeCurrSum + ulProgress;
            end
          else
          if  ulStatusCode  = 6 then  //  데이터 다운로드 완료
            begin
              FileSizeCurrSum :=  FileSizeCurrSum + ulProgress;
              FileSizeCurrent :=  FileSizeCurrSum;
            end;
            frmUpdateHttp.ProgressBarCurrent.Smooth := True;
            frmUpdateHttp.ProgressBarCurrent.Max       := ulProgressMax;
            frmUpdateHttp.ProgressBarCurrent.Position := ulProgress;
            frmUpdateHttp.ProgressBarTotal.Smooth      := True;
            frmUpdateHttp.ProgressBarTotal.Max            := FileSizeTotal;
            frmUpdateHttp.ProgressBarTotal.Position      := FileSizeCurrent;
            Application.ProcessMessages;
        end;
       end;
        if        frmUpdateHttp.ButtonCancel.Tag        =        0        then
                begin
                        Result        :=        S_OK;
                end
        else
                begin
                        Result        :=        E_ABORT;        // 전송을 중간에 취소할때 사용 (Canceled by Returning E_ABORT)
                end;
end;
<!--CodeE-->