Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5992121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:29:09+00:00 2026-05-22T23:29:09+00:00

How to download a file from internet with progress bar using threads in Delphi

  • 0

How to download a file from internet with progress bar using threads in Delphi 2009/10 without Indy components?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:29:10+00:00Added an answer on May 22, 2026 at 11:29 pm

    This uses the clever internet suite to handle the download, I haven’t so much as checked it in the IDE so I wouldn’t expect it to compile and no doubt it’s full of errors but it should be enough to get you started.

    I don’t know why you don’t want to use Indy but I would strongly advise getting some components to help with the Http download… there really is no need to reinvent the wheel.

    interface
    type
        TMyDownloadThread= Class(TThread)
        private
            FUrl: String;
            FFileName: String;
            FProgressHandle: HWND;
            procedure GetFile (Url: String; Stream: TStream; ReceiveProgress: TclSocketProgressEvent);
            procedure OnReceiveProgress(Sender: TObject; ABytesProceed, ATotalBytes: Integer);
            procedure SetPercent(Percent: Double);
        protected
            Procedure Execute; Override;
        public
            Constructor Create(Url, FileName: String; PrograssHandle: HWND);
        End;
    
    implementation
    
    constructor TMyDownloadThread.Create(Url, FileName: String; PrograssHandle: HWND);
    begin
        Inherited Create(True);
        FUrl:= Url;
        FFileName:= FileName;
        FProgressHandle:= PrograssHandle;
        Resume;
    end;
    
    
    procedure TMyDownloadThread.GetFile(Url: String; Stream: TStream; ReceiveProgress: TclSocketProgressEvent);
    var
        Http: TclHttp;
    begin
        Http := TclHTTP.Create(nil);
        try
            try
                Http.OnReceiveProgress := ReceiveProgress;
                Http.Get(Url, Stream);
            except
            end;
        finally
            Http.Free;
        end;
    end;
    
    procedure TMyDownloadThread.OnReceiveProgress(Sender: TObject; ABytesProceed, ATotalBytes: Integer);
    begin
        SetPercent((ABytesProceed / ATotalBytes) * 100);
    end;
    
    procedure TMyDownloadThread.SetPercent(Percent: Double);
    begin
        PostMessage(FProgressHandle, AM_DownloadPercent, LowBytes(Percent), HighBytes(Percent));
    end;
    
    procedure TMyDownloadThread.Execute;
    var
        FileStream: TFileStream;
    begin
        FileStream := TFileStream.Create(FFileName, fmCreate);
        try
            GetFile(FUrl, FileStream, OnReceiveProgress);
        finally
            FileStream.Free;
        end;        
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to download a text file from the internet using C#. The file
I'd like to download a file from my Delphi program in a separate thread
I am using NSURLConnection to download a zipped file from a web service. In
I'm using PHP to create a CSV file from a database query. I run
Is it posible to load a class from the internet in Android? My app
I want to sell my Java application using PayPal. When a payment is received,
I'm trying to install cygwin on my Windows 7 machine. I get the setup
We are creating a php script project; which we will be selling to customers.
Standard scenario: ajax-heavy web application with reports that can be downloaded as files. Problem:
Hi I am new to php eclipse and I have a question about my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.