Page 1 of 2 12 LastLast
Results 1 to 40 of 41

Thread: how do I download files using the Inet control?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    how do I download files using the Inet control?

    hello,

    I just need to transfer a list of files from the internet to a folder.
    how do I do that using the Inet control? is there a better way of
    doing that?

    thanks
    Dekel C.

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: how do I download files using the Inet control?

    Originally posted by dekelc
    hello,

    I just need to transfer a list of files from the internet to a folder.
    how do I do that using the Inet control? is there a better way of
    doing that?

    thanks
    The Inet control is a very good tool for that exact task... Is it just a list you need? You could do; myFile = Inet1.OpenUrl("www.google.com/myfile.txt")

    Please notice that the path is invalid, unless google has something like that laying around(which I do doubt, hehe)
    - change it to the path of your own file
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    the InetControl is great, except all examples used Inet instead of Inet1. Make sure you change that before you run your app.

    oh, and its BIG. A one-line program is 10Mb for the installation.

    Last edited by dglienna; Aug 26th, 2004 at 07:09 PM.

  4. #4
    Hyperactive Member Vishalgiri's Avatar
    Join Date
    Oct 2003
    Location
    India
    Posts
    345
    What protocol you wants to use?
    Regards,
    Vishalgiri Goswami
    Gujarat, ( INDIA ).
    ---------------------

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    what do you mean by 10MB???
    thats a lot for a program that just download stuff from the
    internet... is there another way of doing that?
    and by the way, how do I know in to which folder the Inet is
    downloading?
    Dekel C.

  6. #6
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by dekelc
    what do you mean by 10MB???
    thats a lot for a program that just download stuff from the
    internet... is there another way of doing that?
    and by the way, how do I know in to which folder the Inet is
    downloading?
    You could use winsock, or Api - but that'd make it a whole lot harder...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Yup. When I just compiled it, it was 24Kb, but wouldn't run on my dad's computer. I used P&D, and zipped the output. The zip file is 9,145Kb. I had trouble emailing it to a friend to test, I had to use my dsl email address. I wasn't about to sit at dad's waiting for 10MB to download at 56K, so I burned it onto a CD.

    I solved my other problem by just installing it in the folder that I wanted.

    The program downloads an updated database for a program that his club uses for their golfing handicap system. I had to go over there every week to help dad get things into the right folder.

    Now, I have to teach him how to click the program on the start menu when he knows that there is a fresh copy avaiable. I just got him to be able to run the db program off the start menu without going online to do it! Now, I can coach him from the house if he gets lost.

    All-in-all, a win-win situation. May even offer it to the rest of the group...


  8. #8
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Check this link, it has some sample code:

    http://www.vbforums.com/showthread.p...hreadid=301827
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  9. #9
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    Thumbs up Just API

    VB Code:
    1. Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
    2. Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    3.     Dim lngRetVal As Long
    4.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    5.     If lngRetVal = 0 Then DownloadFile = True
    6. End Function
    7. Private Sub Form_Load()
    8.     'example by Matthew Gates ([email protected])
    9.     DownloadFile "http://www.allapi.net", "c:\allapi.htm"
    10. End Sub

    and you dglienna, i have tried this code and it works fine.

  10. #10
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    I just used the P & D Wizard to create an install of the code I posted here (to download files from the net)
    http://www.vbforums.com/showthread.p...hreadid=301827
    and the entire package came out at 1.48mb. I can't figure out why dglienna's package is ~10mb

    OK, OK, so I haven't tested it on any other PCs yet. I'll do that when I've got some time and get back to you:
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  11. #11
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    1 cab file
    1 lst file
    & setup.exe

    zipped = 9145KB

  12. #12
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    1 cab file
    1 lst file
    & setup.exe

    zipped = 9145KB

  13. #13
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    you used P&D wizard?

    yours may work on my machine with VB, but not on one without.

  14. #14
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    1 cab file 1,378kb
    1 lst file 4kb
    setup.exe 137kb

    I just installed it on a clean Win98 machine and it worked like a charm

    EDIT: And yes, I used the standard VB P & D Wizard
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  15. #15
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    I agree, something is wrong on your side Dglienna... A control that big would loose it's value since the same thing can be achieved with a few lines of API code...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849
    using th api will not cause trouble?
    and how do I know when it finishes the download?
    Dekel C.

  17. #17
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    That API code is VERY VERY basic

    What you need is code that expands on this.

    Attached to this post is a fully working downloader.
    It has a prog bar, and a cancel button.

    What you need to do though is download a zip file from the following site:

    http://www.mvps.org/emorcillo/vb6/tlb/olelib.shtml

    and then follow the instructions and install the tlbs on your PC. This is used for the callback stuff so the downloadurl api can update the prog bar.

    The is VERY good code for downloading a file from a web site.

    Also, you have to remember that windows caches interweb downloads, so the 2nd time you test it it will be VERY VERY quick.
    So you have to manually delete the cached file from the folder.

    Woof
    Attached Files Attached Files

  18. #18
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    hey, dglienna

    this may be one reason that increased ur setup's size.

    If u r using or even have reffered ADO in ur application then Package & Deployment wizard will include MDAC_TYP.EXE file into setup. MDAC_TYP.EXE version 2.5's filesize is 7.50 MB and which is already compressed. Remaining 2.5 MB may includes vb runtimes, inet ocx and application's exe.

    am i right .


    by the way, i think ur name is David. right.

  19. #19
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106
    this is the best, well not the best, but most simple and yet very effective..

    u can shwo the progress on a progress bar n errors n everyhting (nearly )

    well check otu the zip

    (arrg i posted the wrong thing)

  20. #20
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106
    heres the file
    Attached Files Attached Files

  21. #21
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    well, MDAC is there, but I don't know why.
    I just have a form that downloads the file and exits.
    Nothing else. I think that it included it so that it'll work with W98, but I don't know why.
    Any ideas?

  22. #22
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by dglienna
    well, MDAC is there, but I don't know why.
    I just have a form that downloads the file and exits.
    Nothing else. I think that it included it so that it'll work with W98, but I don't know why.
    Any ideas?
    Remove it - there's absolutely no reason for it being there!
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  23. #23
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106
    remove my attachment.

    why>

  24. #24
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    he meant for me to remove MDAC from my project. nobody using it has Win98 (as far as I know) may give it away to fellow golfers... will have it both ways. glad i can make it 75% smaller!


  25. #25
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: hey, dglienna

    Originally posted by Deepak Sakpal
    this may be one reason that increased ur setup's size.

    If u r using or even have reffered ADO in ur application then Package & Deployment wizard will include MDAC_TYP.EXE file into setup.
    I don't think it does.
    You have to manually add this file to the setup.

    If you install ADO by running the setup file, and then delete the file from your PC (since it isn't needed anymore), then how can it be added in?
    Even if it's not deleted how does the P&D Wizard know where this setup file is?

    What it does add is an msado tlb file, for which it says dependacies cannot be found, and it asks you if you want to add that file to the project.
    I believe that you should add this file, but instead add the ado setup exe file.

    Woof

    Woka

  26. #26
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    I remember that I clicked on an ICON thinking it was the INET control. Went to the upper left corner of Form1, and wouldn't really delete. Must have been what caused MDAC. Have to drop my code into a new project to get rid of it.


  27. #27
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    Wokawidget

    Originally posted by Wokawidget
    I don't think it does.
    You have to manually add this file to the setup.

    If you install ADO by running the setup file, and then delete the file from your PC (since it isn't needed anymore), then how can it be added in?
    Even if it's not deleted how does the P&D Wizard know where this setup file is?

    What it does add is an msado tlb file, for which it says dependacies cannot be found, and it asks you if you want to add that file to the project.
    I believe that you should add this file, but instead add the ado setup exe file.

    Woof

    Woka
    Package & Deployment wizard includes MDAC_TYP.EXE automatically in setup, you don't have to include it yourself. See the attached file.
    Attached Images Attached Images  

  28. #28
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Well, I've tested this 3 times on 3 different PCs.
    And all it tried to add is the ado tlb file.

    Are you 100% sure that the file wasn't added in manually?
    Think about this logically. How can it be added in automatically when the pc doesn't know where it is. No values it reg to point to it's location etc.

    Woof

  29. #29
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    Woka

    i am 100% sure and logically speaking how PDW compiles exe again ? how it comes to know where the compiler is located ? The same thing is here.

  30. #30

  31. #31
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    Originally posted by Wokawidget
    Well, I've tried this on 4 machines now.
    Not one added it in automatically.
    I disagree with this. It works for me.

    Ok, let me tell u what steps i followed:
    1 - I created a new vb project and generated a form from Data Form wizard which added reference to Microsoft ActiveX Data Objects 2.0 Library
    2 - I compiled my project and created exe.
    3 - Selected Package & Deployment Wizard from Microsoft Visual Studio 6.0 Tools menu.
    4 - Selected my .vbp file from browse button
    5 - Clicked 'Package' button and clicked next button two times and that screen (which i posted in my last post) appeared with MDAC_TYP.EXE file included in Files list automatically.

    what can i say more

  32. #32

  33. #33
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    Talking hehe

    I use Inno too

  34. #34
    New Member
    Join Date
    Sep 2004
    Posts
    4
    Hi, i'm new =P

    I'm attempting a similar thing to the topic creator, and
    Deepak Sakpal's code worked nicely. My question is: how would i go about performing this operation backwards; ie, uploading from a local file to the web?
    I'm making an rankings program for a game; i want it to be able to download the scores file, let the user change their scores and settings etc, and then replace the online file with the updated file.

    Any help, or suggestions on alternative methods of achieving this?

  35. #35

  36. #36
    New Member
    Join Date
    Sep 2004
    Posts
    4
    I own a portion of the web server, and it's not a webpage; i'd be uploading to a directory.

    I think >_> <_<

    I'm pretty unfamiliar with web programming and stuff, so forgive me if i don't make sense.

  37. #37

  38. #38
    New Member
    Join Date
    Sep 2004
    Posts
    4
    For the sake of the argument, yes i can...but i don't know how.
    I can see this is going to be quite the complicated.
    what if i were to store the data in a publicly writeable folder?

  39. #39
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Errr...publicly wriable folder...errrr...then there would be no need for a single line of VB code.

    If you wanted to "upload" a file to a server...and you don't have a drive mapped to it, then u must have some sort of app running on the server that you can connect to and then send the file to.

    This can be an EXE using winsock, or a web server with web pages.

    Woka

  40. #40
    New Member
    Join Date
    Sep 2004
    Posts
    4
    I see. In that case, would it be possible to point me in the direction of a tutorial or some samples related to doing so?
    Thanks for your help Woka.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width