Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, kzhao, 7th_zorro), 714 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 2 1 2
Download DLL #259807
04/07/09 19:55
04/07/09 19:55
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

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.rar

Following functions are defined:
Code:
//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:

Code:

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
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

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:
Code:
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: TechMuc] #259816
04/07/09 21:00
04/07/09 21:00
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Maybe you'd better add some value to see is download starts...
Or, for example, DownloadGetStatus(m_id) return -1 as download not started at all... because there are a lot of different computers and a lot of different connections.. maybe 10 ticks woulnd't be enough smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Download DLL [Re: VeT] #259831
04/07/09 23:05
04/07/09 23:05
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
im using this:

STRING* m_num="#200";
int m_id = DownloadStart("http://www.imotion.com.br/imagens/data/media/41/8855ilha.jpg","8855ilha.jpg");
wait(-3);
while(DownloadGetStatus(m_id)){
str_for_num(m_num,(var)DownloadGetStatus(m_id));
draw_number(m_num,20,20,vector(222,222,222));
wait(1);
}

but the string is showing 234029840.340 what is means?

Re: Download DLL [Re: MMike] #259836
04/07/09 23:16
04/07/09 23:16
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
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: MMike] #259864
04/08/09 01:29
04/08/09 01:29
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
smile Thanks for this. im sure it will be very handy not only for me but others. Gs was lacking something like this.

Last edited by MMike; 04/08/09 01:37.
Re: Download DLL [Re: MMike] #259909
04/08/09 07:49
04/08/09 07:49
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
looks nice gotta try it now.


3333333333
Re: Download DLL [Re: Quad] #259982
04/08/09 12:42
04/08/09 12:42
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
So nice! smile

Re: Download DLL [Re: Cowabanga] #260026
04/08/09 15:45
04/08/09 15:45
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi,

thanks for the contribution! Is it ok for you when we get the sourcecode, too?

Re: Download DLL [Re: HeelX] #260043
04/08/09 17:22
04/08/09 17:22
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

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.

Page 1 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1