Prev: MSXML Error
Next: VB - SOAP ERROR
From: Hnd on 13 Jul 2005 14:49 Hello, Look through this snippet for my question... Thanks. Does anyone have any suggestions? ///// Visual Basic 6.0 ///// Sub getImage() Dim ie As InternetExplorer Set ie = New InternetExplorer Dim doc As HTMLDocument Set doc = New HTMLDocument Dim images As IHTMLElementCollection url = "[some html document on the web with <img> tags]" ie.Navigate (url) Set doc = ie.Document Set images = doc.images For Each Item In images '///////////////////////////// question What do I put here to get the binary data returned from the image tag contained in the doc object? When using the .navigate method with the InternetExplorer object, does it return actual binary content that I can access and store on the hard drive? Or, does it just return the html document "text" without returning any "byte arrays" which would be image data? MUST I use the stream object and the msxml object to do this? It seems I should be able to .navigate to some binary resource URL and then get the binary data from the HTMLDocument object. Is there another class in the (\WINNT\system32\MSHTML.TLB) MSHTML library I'm missing which would easily do this? '///////////////////////////// end question Next End Sub All answers are appreciated. Thanks.
From: Mike D Sutton on 13 Jul 2005 15:30 > Hello, Look through this snippet for my question... > Thanks. Does anyone have any suggestions? <code snipped> > What do I put here to get the binary data returned from the image tag > contained in the doc object? > > When using the .navigate method with the InternetExplorer object, does > it return actual binary content that I can access and store on the > hard drive? Or, does it just return the html document "text" without > returning any "byte arrays" which would be image data? > > MUST I use the stream object and the msxml object to do this? > > It seems I should be able to .navigate to some binary resource URL and > then get the binary data from the HTMLDocument object. > > Is there another class in the (\WINNT\system32\MSHTML.TLB) MSHTML > library I'm missing which would easily do this? I don't know of any way to do this through the object model, but the HTMLImg object has an href property which specifies the URI to the image, you can then use the Internet*() API calls to go and grab that file. Since both objects use the same internet cache, if web browser has already downloaded the file then this will simply pull back the local copy of the file. To grab the file use the InternetOpen(), InternetOpenUrl(), InternetReadFile() and InternetCloseHandle() API calls. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: EDais(a)mvps.org WWW: Http://EDais.mvps.org/
From: Hnd on 13 Jul 2005 20:15 On Wed, 13 Jul 2005 20:30:43 +0100, "Mike D Sutton" <EDais(a)mvps.org> wrote: look below... >> Hello, Look through this snippet for my question... >> Thanks. Does anyone have any suggestions? ><code snipped> >> What do I put here to get the binary data returned from the image tag >> contained in the doc object? >> >> When using the .navigate method with the InternetExplorer object, does >> it return actual binary content that I can access and store on the >> hard drive? Or, does it just return the html document "text" without >> returning any "byte arrays" which would be image data? >> >> MUST I use the stream object and the msxml object to do this? >> >> It seems I should be able to .navigate to some binary resource URL and >> then get the binary data from the HTMLDocument object. >> >> Is there another class in the (\WINNT\system32\MSHTML.TLB) MSHTML >> library I'm missing which would easily do this? > >I don't know of any way to do this through the object model, but the HTMLImg object has an href property which specifies >the URI to the image, you can then use the Internet*() API calls to go and grab that file. Since both objects use the >same internet cache, if web browser has already downloaded the file then this will simply pull back the local copy of >the file. >To grab the file use the InternetOpen(), InternetOpenUrl(), InternetReadFile() and InternetCloseHandle() API calls. >Hope this helps, > > Mike > > > - Microsoft Visual Basic MVP - >E-Mail: EDais(a)mvps.org >WWW: Http://EDais.mvps.org/ > Thanks. As an even better time saver, I could add the internet shdocvw.dll class to a form and then use it's methods to navigate to the binary resource. The control on the VB form will put the binary into the cache defined by the pre-existing control by the installation of windows. Can I change the form.[internetControl].[properties] while it is running to cache the images to another directory?
From: Mike D Sutton on 14 Jul 2005 07:31 > As an even better time saver, I could add the internet shdocvw.dll > class to a form and then use it's methods to navigate to the binary > resource. The control on the VB form will put the binary into the > cache defined by the pre-existing control by the installation of > windows. > > Can I change the form.[internetControl].[properties] while it is > running to cache the images to another directory? I would doubt it, the cache is actually made up of many directories anyway so even if you set the base directory the image would be stored in a randomly named sub-directory anyway. Mike - Microsoft Visual Basic MVP - E-Mail: EDais(a)mvps.org WWW: Http://EDais.mvps.org/
|
Pages: 1 Prev: MSXML Error Next: VB - SOAP ERROR |