Hi There,
How can I Implement a banner system in VB, just like the download accelearator has?
If you anyone has some code it would be nice.
Thanks,
João Pinto
Printable View
Hi There,
How can I Implement a banner system in VB, just like the download accelearator has?
If you anyone has some code it would be nice.
Thanks,
João Pinto
First, place ALL the banner logos on a web site, like
http://www.banners.com/logo/
and give them a number between 1 to 2000
Then, add an inet and image control and use the code:
:)?Code:Public Sub Banner()
Dim d() as byte
d = inet.openurl("websitename" & rand(0, num_of_images))
open "C:\temp.gif" for output as #1
Print #1, d
close #1
image1.picture = loadpicture("C:\temp.gif")
End Sub
I'me getting a error type mismatch in the line:
d = Inet.openurl("http://www.site.com/images/banners/banner.gif")
Do you know why?
Thanks,
João Pinto
Use a WebBrowser control for this, then use the following method to navigate.
Code:WebBroswer1.Navigate "www.site.com/banner1.html"
You can use:
OR:Code:Dim bData() As Byte ' Data variable
Dim intFile As Integer ' FreeFile variable
intFile = FreeFile() ' Set intFile to an unused
' file.
' The result of the OpenURL method goes into the Byte
' array, and the Byte array is then saved to disk.
bData() = Inet1.OpenURL(strURL, icByteArray)
Open "C:\banner.gif" For Binary Access Write _
As #intFile
Put #intFile, , bData()
Close #intFile
Then useCode:Dim intFile As Integer ' FreeFile variable
intFile = FreeFile() ' Set intFile to an unused
' file.
' The result of the OpenURL method goes into the Byte
' array, and the Byte array is then saved to disk.
Open "C:\banner.gif" For Output As #intFile
Put #intFile, , Inet1.OpenURL(strURL)
Close #intFile
The last code is not debugged, so that's why it's wrong.Code:image1.picture = loadpicture("C:\Banner.gif")
Megatron, it's better to use an inet control, because a WebBrowserQuote:
Originally posted by Decepticon Megatron, whose authority is being questioned.
Use a WebBrowser control for this, then use the following method to navigate.
Code:WebBroswer1.Navigate "www.site.com/banner1.html"
1) Takes more resources
2) Looks clumsy - Won't even DISPLAY inages if the feature is turned off in IE
3) Slow
4) By Microsoft
5) Has a 3D border and right-click context menus
1) Can't argue with that
2) huh??
3) You can compensate by loading your banner first, then showing your App after the loading is done.
4) So?
5) 3D borders look nice. It's a matter of preference
PictureBoxes cannot display HTML files, a WebBroswer can.
1) works only when the user has ie 4 or above
2) in internet explorer there's an option to turnoff images (only alt-text would be visible)
3) slow vs. safe way to show an image... ;)
4) Microsoft Internet Controls and Microsoft Internet Transfer Control... :rolleyes: Isn't it both by MS??? :confused:
5) just put it in another container... move it to -30, -30, Parent's Scalewidth+60, Parent's Scaleheight+60 ...
5b) Microsoft has provided us with a "powerful" dll :D that disables the rightclick and allows many other things...
Wouldn't it be a nice question for a poll??
Also, it add to the space of the program by adding a large OCX.
The borders and the menu -- disabling them will take expert GDIs. We're not all as smart as you, megatron.
Most web banners don't use HTML pages. They only do that for cookies and what is there to find out on an ad banner?
IE is very buggy. If the manufacturer send a "bug" HTML page...
Oh, and the By Microsoft is not serious. I thought programmers have a sense of humor?!