|
-
Jul 10th, 2006, 11:17 AM
#1
Thread Starter
Hyperactive Member
Displaying an url
Hi there,
I don't know if the title is apropriate but what I intend to do is create an area linked to an url... that is, an area where it is shown an image that is available online when I define a link...
example: I want to insert in a picturebox (or whatever) the image available in this link: "https://mail.ua.pt/header_60_300.gif"
I hope I have been clear..
Any help is most apreciated.. thanks in advance
-
Jul 10th, 2006, 11:26 AM
#2
Re: Displaying an url
You will need to download the image file manually. For that, you can use URLDownloadToFile().
VB Code:
' Declaration:
Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileW" ( _
ByVal pCaller As Long, _
ByVal szURL As Long, _
ByVal szFileName As Long, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long _
)
'Usage:
URLDownloadToFile( _
0, _
StrPtr("https://mail.ua.pt/header_60_300.gif"), _
StrPtr(App.Path & "\temp\header_60_300.gif"), _
0, _
0 _
)
HTH.
-
Jul 10th, 2006, 11:59 AM
#3
Thread Starter
Hyperactive Member
Re: Displaying an url
Thanks,
I'll try it as soon as I can...
However, won't it make a bit slow.. since I intend to call the image many times..
is there a faster way to do it?
-
Jul 10th, 2006, 12:01 PM
#4
Re: Displaying an url
The function actually uses Internet Explorer's cache. So as long as there is space in the cache, it will be retrieved from there rather than being re-downloaded.
-
Jul 10th, 2006, 01:22 PM
#5
Fanatic Member
Re: Displaying an url
There are other ways of getting the file, but the URLDownloadToFile API is the easiest.
You could alternatively use the Inet control or Winsock
-
Jul 10th, 2006, 01:45 PM
#6
Re: Displaying an url
you could also use the Webbrowser control and write HTML directly to it.. using the creating the link and grabbing the image in the HTML...
no download needed then..
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 11th, 2006, 03:13 AM
#7
Thread Starter
Hyperactive Member
Re: Displaying an url
Do you have a working example for the Webbrowser control?
I'm still new in VB and I understand better when I can see the code ...
thanks in advance
-
Jul 11th, 2006, 03:21 AM
#8
Lively Member
Re: Displaying an url
 Originally Posted by Static
you could also use the Webbrowser control and write HTML directly to it.. using the creating the link and grabbing the image in the HTML...
no download needed then..
that uses ie control and ie chache lol
-
Jul 11th, 2006, 07:31 AM
#9
Re: Displaying an url
No it doesnt as you can force it not to.. but this way will give you your clickable image all in one
VB Code:
Private Sub Form_Load()
WebBrowser1.Navigate "about:blank"
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
DoEvents: DoEvents
Loop
Dim HTML As String
HTML = "<HTML>" & vbCrLf & _
"<style type=text/css>" & vbCrLf & _
"html,body {" & vbCrLf & _
"height:100%;" & vbCrLf & _
"width:100%;" & vbCrLf & _
"overflow:hidden;" & vbCrLf & _
"}" & vbCrLf & _
"</style>" & vbCrLf & _
"<BODY><A HREF=http://www.vbforums.com>" & vbCrLf & _
"<IMG SRC=" & Chr(34) & "http://www.google.com/intl/en/images/logo.gif" & Chr(34) & " border=0>" & vbCrLf & _
"</A></BODY></HTML>"
WebBrowser1.Document.write HTML
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 13th, 2006, 03:30 AM
#10
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|