|
Download DLL
#259807
04/07/09 19:55
04/07/09 19:55
|
Joined: Jul 2008
Posts: 894
TechMuc
OP
User
|
OP
User
Joined: Jul 2008
Posts: 894
|
Hey, Yeah i know there are some Download DLL's out there, but none that is really working good. Here is my version. Every single file is downloaded in a different thread ==> The Engine window is not blocked BUT you have to pay attention to finish EVERY download (or at least stop and wait a frame) before closing the engine. You can get the DLL from here: http://techmuc.kilu.de/Download.rarFollowing functions are defined:
//Start the download and returns a unique identifier to the current download process
//example: var id = DownloadStart("http://www.yourserver/file.chm"."file.chm"):
var DownloadStart(char* web,char*,local);
//returns the progress of the id (in Percent)
var DownloadGetProgress(var m_id);
//returns the progress of the id (in KiloBytes)
var DownloadGetProgressInKBytes(var m_id);
//stops a specifc download
var DownloadStop(var id);
//returns the absolute size (to download) of a certain id
var DownloadGetSize(var m_id);
//returns the status of an id (1 = downloading, 0 = not downloading)
var DownloadGetStatus(var m_id);
At last a small sample:
int m_id = DownloadStart("http://www.server.de/box.rar","box.rar");
wait(15);
while(DownloadGetStatus(m_id))
{
str_for_num(m_num,(var)DownloadGetProgress(m_id));
str_cpy(m_str,m_num); str_cat(m_str,"\n");
str_for_num(m_num,(var)DownloadGetProgressInKBytes(m_id));
str_cat(m_str,m_num); str_cat(m_str,"\n");
str_for_num(m_num,(var)DownloadGetSize(m_id));
str_cat(m_str,m_num); str_cat(m_str,"\n");
str_for_num(m_num,(var)DownloadGetStatus(m_id));
str_cat(m_str,m_num); str_cat(m_str,"\n");
wait(1);
}
best wishes
|
|
|
Re: Download DLL
[Re: TechMuc]
#259810
04/07/09 20:09
04/07/09 20:09
|
Joined: Jul 2008
Posts: 894
TechMuc
OP
User
|
OP
User
Joined: Jul 2008
Posts: 894
|
sorry there was a slight problem. I've updated the DLL file. Please do not expect the following code to work:
DownloadStart("i","i");
while(DownloadGetStatus(m_id))
{
..
}
You have to insert(!!!) a wait after DownloadStart. I recommand to wait ~10 ticks to be sure that downloading started.
|
|
|
Re: Download DLL
[Re: MMike]
#259836
04/07/09 23:16
04/07/09 23:16
|
Joined: Jul 2004
Posts: 1,710
MMike
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,710
|
how i see how it works.
Tech you must exaplain maybe better.. at least i did not understand at first.
//example: var id = DownloadStart("http://www.yourserver/file.chm"."file.chm"): var DownloadStart(char* web,char*,local);
you added an extra comma by nmistake on the description!
So for download images.. or anything Else: var DownloadStart(char* WEB_URL,char* save_as.XXX);
save_as is the name you want the file to be saved, and you can define the extension of it.
For downloading an HTML CODE simple use:
var DownloadStart("http://www.google.com", google.html); or var DownloadStart("http://www.google.com", google.txt);
Thanks. I rated this post 5 stars.
Last edited by MMike; 04/07/09 23:17.
|
|
|
Re: Download DLL
[Re: HeelX]
#260043
04/08/09 17:22
04/08/09 17:22
|
Joined: Jul 2008
Posts: 894
TechMuc
OP
User
|
OP
User
Joined: Jul 2008
Posts: 894
|
@all: i updated the dll. Waits are not needed anymore @heelX: Download the Source from: http://techmuc.kilu.de/DownloadSrc.rar . I use some wxWidgets Platform libraries (just an Array container, and a String Class) - which can be easily ereased from the source code, if you want to implement it to your project.
|
|
|
|