From: Southern at Heart on
Yes, that's the link
Okay, I have looked at that method you mention earlier, but I can't quite
figure out how to make it work. I you could please help me make it work with
this url
http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8
....then I think I could work out how to get the rest of my code to work with
that.
Sorry I'm not a "real" programmer, and I'm a bit blonde!




"Karl E. Peterson" wrote:

> Southern at Heart wrote:
> > ...I don't know if that method will work, as the image I'm wanting to save is
> > not a 'real' image until IE loads it.
> > ...so what I end up with is a .gif file in the clipboard. Is there a way to
> > save a .gif file that's on the clipboard to a file?
>
> Oh, ick! I really didn't look closely at the code you were using, or
> the page you pointed to. I don't even see the GIF in the source for
> that, either. I guess it's this, eh?
>
> http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8
>
> Why do you say it's not a "real image" until IE loads it? Is the other
> server creating it on demand? That API call will do the same thing,
> essentially.
>
> Anyway, yes, it is potentially possible to save a GIF from the
> clipboard to file, but it's not a very simple process at all. I would
> definitely try everything you can to find another route.
>
> --
> ..NET: It's About Trust!
> http://vfred.mvps.org
>
>
> .
>
From: Karl E. Peterson on
Southern at Heart wrote:
> Yes, that's the link
> Okay, I have looked at that method you mention earlier, but I can't quite
> figure out how to make it work. I you could please help me make it work with
> this url
> http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8
> ...then I think I could work out how to get the rest of my code to work with
> that.
> Sorry I'm not a "real" programmer, and I'm a bit blonde!

It's about as straight-forward as they come. Randy did a very good job
of isolating what's necessary. Add the following code to any standard
module in your project:

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

Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10

Public Function DownloadFile(SourceUrl As String, _
LocalFile As String) As Boolean
' Download the file. BINDF_GETNEWESTVERSION forces
' the API to download from the specified source.
' Passing 0& as dwReserved causes the locally-cached
' copy to be downloaded, if available. If the API
' returns ERROR_SUCCESS (0), DownloadFile returns True.
DownloadFile = URLDownloadToFile(0&, _
SourceUrl, _
LocalFile, _
BINDF_GETNEWESTVERSION, _
0&) = ERROR_SUCCESS
End Function

You can then test it with your URLs, something like this:

Public Sub Test()
Debug.Print DownloadFile( _

"http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8",
_
Environ$("tmp") & "\test.gif")
End Sub

Here, I just stashed it in the temp folder. You may want to put it
somewhere else. The DownloadFile routine accepts a source and
destination string, giving you full control of that, and returns a
success or failure code.

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Southern at Heart on
Thanks! This looks like something I can handle! I think I CAN do it!
I'll try this tonight.
cheers.


"Karl E. Peterson" wrote:

> Southern at Heart wrote:
> > Yes, that's the link
> > Okay, I have looked at that method you mention earlier, but I can't quite
> > figure out how to make it work. I you could please help me make it work with
> > this url
> > http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8
> > ...then I think I could work out how to get the rest of my code to work with
> > that.
> > Sorry I'm not a "real" programmer, and I'm a bit blonde!
>
> It's about as straight-forward as they come. Randy did a very good job
> of isolating what's necessary. Add the following code to any standard
> module in your project:
>
> 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
>
> Private Const ERROR_SUCCESS As Long = 0
> Private Const BINDF_GETNEWESTVERSION As Long = &H10
>
> Public Function DownloadFile(SourceUrl As String, _
> LocalFile As String) As Boolean
> ' Download the file. BINDF_GETNEWESTVERSION forces
> ' the API to download from the specified source.
> ' Passing 0& as dwReserved causes the locally-cached
> ' copy to be downloaded, if available. If the API
> ' returns ERROR_SUCCESS (0), DownloadFile returns True.
> DownloadFile = URLDownloadToFile(0&, _
> SourceUrl, _
> LocalFile, _
> BINDF_GETNEWESTVERSION, _
> 0&) = ERROR_SUCCESS
> End Function
>
> You can then test it with your URLs, something like this:
>
> Public Sub Test()
> Debug.Print DownloadFile( _
>
> "http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8",
> _
> Environ$("tmp") & "\test.gif")
> End Sub
>
> Here, I just stashed it in the temp folder. You may want to put it
> somewhere else. The DownloadFile routine accepts a source and
> destination string, giving you full control of that, and returns a
> success or failure code.
>
> --
> ..NET: It's About Trust!
> http://vfred.mvps.org
>
>
> .
>