dcsimg
Results 1 to 12 of 12

Thread: Downloading Image to Hard Disk Using Webbrowser control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Downloading Image to Hard Disk Using Webbrowser control

    Is there away to do so?

    Does htmlimg object contain the binary data of the image somewhere?

    I can use URLdownloadtofile API but that means I am bypassing internetexplorer proxy

    I want to download file through internet explorer

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Downloading Image to Hard Disk Using Webbrowser control

    If it's showing in the browser, then it's already downloaded to your computer. IE saves images and stuff to a temporary/cache folder. You may have to figure out the path it saves to and copy it to another folder.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Downloading Image to Hard Disk Using Webbrowser control

    Okay. I have to figure out the path and copy it to another folder. The question is how?

    Anyone knows? I need ways that work both for vb6 and vb.net

  4. #4
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Downloading Image to Hard Disk Using Webbrowser control

    C:\Documents and Settings\WINDOWS_USERNAME\Local Settings\Temporary Internet Files

    That's the folder for me. I went to Google and then opened that folder and saw the logo.gif file. The name of the file is the same as it appears in the webpage. I'm pretty sure it's just a shortcut, though.

    Maybe someone else knows more about this, I don't really have the time at the moment to try.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Downloading Image to Hard Disk Using Webbrowser control

    Interesting. The name of the file is the same with the name of the appearingin webpage.

    Is there a way to know the location of C:\Documents and Settings\WINDOWS_USERNAME\Local Settings\Temporary Internet Files automatically or programatically?

    This seems to be a good enough solution.
    Last edited by teguh123; Oct 6th, 2009 at 06:20 AM.

  6. #6
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Downloading Image to Hard Disk Using Webbrowser control

    I would use SHGetSpecialFolderLocation

    I found this, only skimmed through it quickly. It might have what you need:
    http://www.vbforums.com/showthread.php?t=99951

  7. #7
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Downloading Image to Hard Disk Using Webbrowser control

    Just so you know, when you use the URLDownloadToFile API, if the file exists it will copy that file from the cache for you and not use more bandwidth (or so it seems to me when I use it in conjunction with the webbrowser control). Give it a test...



    Good Luck
    Option Explicit should not be an Option!

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Downloading Image to Hard Disk Using Webbrowser control

    So if the file exist it'll get that from internet explorer cache and if it doesn't it'll download?

    Actually I do use urldownloadtofile API. The cache is definetely there but the download just fail. The download doesn't fail if IE do not use proxy.

    I think urldownloadtofile does use a cahce, but it's a different cache than the one internet explorer use.

    Can anyone confirm this?

    Let me check.
    Last edited by teguh123; Oct 6th, 2009 at 10:06 PM.

  9. #9
    Registered User
    Join Date
    Dec 2004
    Posts
    24,634

    Re: Downloading Image to Hard Disk Using Webbrowser control

    it is also possible to copy and paste images from the webbrowser itself, there was a thread on that recently

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Downloading Image to Hard Disk Using Webbrowser control

    Oh really.

    That would be the best way. How? I've been looking for it.

  11. #11
    Registered User
    Join Date
    Dec 2004
    Posts
    24,634

    Re: Downloading Image to Hard Disk Using Webbrowser control


  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Downloading Image to Hard Disk Using Webbrowser control

    Okay, I used SHGetSpecialFolderLocation. I manage to get the name of the file.

    However, it seems that it's not a regular file. If I double click it will open firefox rather than regular image.

    Also fileExist(theFile) where

    Public Function fileExist(filename As String) As Boolean
    Dim fso As FileSystemObject
    Set fso = New FileSystemObject
    fileExist = fso.FileExists(filename)
    End Function

    will produce false.

    so the file is C:\Documents and Settings\Ferry\Local Settings\Temporary Internet Files\thefile.jpg which is correct. But it'll produce false as if there is no such file.

    Hmm.... Any other alternative?

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width