forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


File download with URLMON.DLL and VDSug.dll

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Mar 11, 2004 2:39 pm    Post subject: File download with URLMON.DLL and VDSug.dll Reply with quote

VDS 3 and VDS 4 compatible

Here's a VDSug.dll conversion of Skit's URLMON.DLL
example in the "Visual DialogScript 5 Units" forum.

It takes a file URL and a local destination path\filename
as command parameters.

Note: The function only downloads existing files, it
will NOT retrieve web pages that are created as you
log on (such as the index.php for VDSworld forums).
Not on my system anyway. Wink

Requires VDSug.dll, IE 3 or later, and Windows 95 or later.
_____________________________________________________________________________________________________________
Code:

TITLE Urlmon.dll Download Utility

if @not(%1)@not(%2)
   WARN Insufficient parameters...@tab()
   EXIT
end

rem -- target URL and destination path\filename --
%%url = %1
%%file = %2

EXTERNAL VDSug.dll
UG DLLLOAD, 1, urlmon.dll
UG DLLINITFUNC, 1, 1, URLDownloadToFileA

OPTION ERRORTRAP, t1
  rem -- %z is zero unless memory error --
  %z = @ug(DLLFUNC, URLDownloadToFileA, int, int:0, str:%%url, str:%%file, int:0, int:0)
:t1

if @file(%%file)
   INFO Download complete...@tab()
else
   WARN Download failed!@tab()
end


Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Mar 11, 2004 11:19 pm    Post subject: Reply with quote

A note on this example...

If you do not delete an existing file before downloading it
again, the popup window will show "Download Complete"
even if the download was a failure.

This is because it checks the file's existence as verification of
download success. As an alternative, you could add code to
check an existing file's timestamp before and after download
for verification. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group