allie910
asked on
show that program is downloading using progressbar..?
hi all,
I use my program to download some file from a website, sometimes the connection is very slow (well, i can't do anything about that). The problem is... if the connectiong is slow... it looks like that if my program hang. (it looks like it doesn't do anything).
my question is, is there any way that I can do to indicate that my program is still running...?? showing a progressbar maybe..??
I use my program to download some file from a website, sometimes the connection is very slow (well, i can't do anything about that). The problem is... if the connectiong is slow... it looks like that if my program hang. (it looks like it doesn't do anything).
my question is, is there any way that I can do to indicate that my program is still running...?? showing a progressbar maybe..??
what are you using for download ? Indy ? if you're using TidHTTP then it's rather simple .. just chain in a IdConnectionIntercept and use it's OnReceive event
if you're using URLDownloadToFile then you can set a status callback
function URLDownloadToFile(Caller: IUnknown; URL: PChar; FileName: PChar; Reserved: DWORD; StatusCB: IBindStatusCallback): HResult; stdcall;
StatusCB is the param you need
if you have D7 you can use TDownloadURL class .. it's an Action with an OnDownloadProgress event
if you're using URLDownloadToFile then you can set a status callback
function URLDownloadToFile(Caller: IUnknown; URL: PChar; FileName: PChar; Reserved: DWORD; StatusCB: IBindStatusCallback): HResult; stdcall;
StatusCB is the param you need
if you have D7 you can use TDownloadURL class .. it's an Action with an OnDownloadProgress event
Well yeah it all depends on how you're downloading it... it sounds to me that whatever you're using is a blocking type socket and your application must be freezing everytime it waits for incoming data..
If you can't use a ProgressBar i suggest threading the code and then use a timer to display a little animation to show it's still downloading... or rewrite the way it downloads the file and use a progressbar.
If you can't use a ProgressBar i suggest threading the code and then use a timer to display a little animation to show it's still downloading... or rewrite the way it downloads the file and use a progressbar.
ASKER
oopss.. sorry i guess I forgot to attach my code there....
well, here is my code : (im using indy http ==> idHttp to get the file)
HTMLContent := IdHTTP1.Get(IEAddress);
thanks :D
well, here is my code : (im using indy http ==> idHttp to get the file)
HTMLContent := IdHTTP1.Get(IEAddress);
thanks :D
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure TfrmUpdate.HTTPGet(Sender:
begin
Progress.Max := TotalSize;
Progress.Position := Readed;
end;
And it is working... :)