Results 1 to 3 of 3

Thread: Saving a Webbrowser control image to disk

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    2

    Saving a Webbrowser control image to disk

    I'm not a VB programmer but I am attempting a little utility program. My program uses a webbrowser control and retrieves an image from an internet webpage via a direct url. What I want to do is save that image every X minutes to a file on my PC. It's an animated gif (radar image). I would like to save it as a unique name each time, so that I have a running history of all the images (the webpage updates once every hour).

    Any ideas out there?

    Here is my source (so far) that I hacked from another program (written in VB6)....

    Const Flags = 0
    Const Target = ""
    Const Headers = ""

    Dim PostDataSet() As Byte

    Private Sub Form_Load()

    SendMessage
    Me.Show

    End Sub

    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

    'SaveAsFile WebBrowser1.Document
    'Unload Me

    End Sub

    Function SaveAsFile(ByVal htmlPage As HTMLDocument)


    '???? how to save the image as a file


    End Function

    Function SendMessage()

    WebBrowser1.RegisterAsBrowser = True
    WebBrowser1.Navigate "http://www.landi.ch/meteoftp/radarbild/radar.gif", Flags, Target, PostDataSet, Headers

    End Function

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: Saving a Webbrowser control image to disk

    Use "Microsoft Internet Transfer Control"

    That way, you can do this:
    VB Code:
    1. Dim b() as byte
    2. b = Inet1.OpenURL("http://www.landi.ch/meteoftp/radarbild/radar.gif", icByteArray)
    3.  
    4. Open App.Path & "/radar.gif" for binary access write lock read as #1
    5. Put #1,,b
    6. Close #1

    r0ach™
    Don't forget to rate the post

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    2

    Re: Saving a Webbrowser control image to disk

    Quote Originally Posted by r0ach
    Use "Microsoft Internet Transfer Control"

    That way, you can do this:
    VB Code:
    1. Dim b() as byte
    2. b = Inet1.OpenURL("http://www.landi.ch/meteoftp/radarbild/radar.gif", icByteArray)
    3.  
    4. Open App.Path & "/radar.gif" for binary access write lock read as #1
    5. Put #1,,b
    6. Close #1
    i try to add this component to my form and it says "license information for this component not found". you do not have appropriate license to use this functionality in design environment". what's up with that?

    btw, I am rewriting this program from one written by a friend last year. the URL changed and sadly, i don't have the source. i know it was working with the webbrowser control before - do you know how to simply save the image inthe webbrowser to disk? I'm 90% there - i just need it to save.

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