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'm using urllib.urlretrieve to download a file, and implementing a download progress bar using
Thanks to this thread How to download and save a file from Internet using
How do I download a file from the internet in a Flex based AIR
I want to download a file from Internet and InternetReadFile seem a good and
I want to download a file from internet and I imagine this should be
I am trying to download an HTML file from the internet and store it
I'm trying to download a file from the internet, but I get the error
Is it possible to download a file from a website in Windows Application form
I'm trying to use SQL Server 2000 DTS Package to download a file from
I have a microcontroller that must download a large file from a PC serial

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.