Results 1 to 9 of 9

Thread: How can I implement a banner system in VB?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2001
    Posts
    44
    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

  2. #2
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    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
    ?


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2001
    Posts
    44
    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

  4. #4
    Megatron
    Guest
    Use a WebBrowser control for this, then use the following method to navigate.
    Code:
    WebBroswer1.Navigate "www.site.com/banner1.html"

  5. #5
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    You can use:

    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
    OR:

    Code:
    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
    Then use

    Code:
    image1.picture = loadpicture("C:\Banner.gif")
    The last code is not debugged, so that's why it's wrong.
    Last edited by Microbasic; Apr 8th, 2001 at 04:45 PM.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  6. #6
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    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"
    Megatron, it's better to use an inet control, because a WebBrowser

    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


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  7. #7
    Megatron
    Guest
    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.

  8. #8
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    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... Isn't it both by MS???

    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 that disables the rightclick and allows many other things...

    Wouldn't it be a nice question for a poll??
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  9. #9
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    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?!


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

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