Results 1 to 13 of 13

Thread: How would I make visual basic:

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    How would I make visual basic:

    Ok, I am using a amp, and it sends chatsends to Yahoo, but I am wondering when it gets the song, how would I make it able to upload a signature(userbar) to a forum to show what artist - song is playing?

    Example:

    On a forum you want to show what music you're listning to or if it is closed on a userbar: like userbars.com

    How would you make visual basic upload the song/userbar to some where everytime the song changes?

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: How would I make visual basic:

    It wouldn't work for all forums as they all work differently, but you could do it with a specific forum, such as this one. However it's a bit of a waste of bandwidth to be logging in and changing it every 3mins, most of the songs wouldn't show in new posts anyway, unless you are posting 1 or more every 3mins or so.

    Anyway the way I would do it would be something like:
    Code:
    Connect a Winsock to vbforums.com port 80
    Send HTTP request for control panel page
    If response is "need to log in"
         Send HTTP request with login data
         if response is valid login info
              send HTTP request with login data
         else
              invalid login, tell user
              exit
         end if
    else ' its already logged in
         send HTTP request with new sig data
         if response is positive
              wait for next song change
         else
              error occured tell user
             exit
         end if
    end if
    you could also do it with an Inet control or any other method of communicating with a web server over HTTP
    Last edited by the182guy; Feb 3rd, 2007 at 11:29 AM.
    Chris

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: How would I make visual basic:

    That coding doesn't really help, as how would I send login data/request to a cpanel to a forum?

    Example this is the coding i got:

    Private Sub tmrGetSong_Timer()
    On Error Resume Next
    Dim X As String, s() As String
    WinAmp32.WinAmpCurrentMP3
    If Label1.Caption = WinAmp32.WinAmpCurrentMP3 Then Exit Sub
    X = WinAmp32.WinAmpCurrentMP3
    If InStr(1, X, "-") > 0 Then
    s = Split(X, "-", 2)
    lblArtist.Caption = s(0)
    Label1.Caption = s(1)
    Else
    Label1.Caption = X
    End If

    Winsock1.Connect "vbforums.com", "80"
    End Sub

    Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    If Number = 11004 Then
    Winsock1.SendData "gthkane"
    Winsock1.SendData "******"
    End If
    End Sub

    and that doesn't work, any ideas on how to get it to work better?

  4. #4
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: How would I make visual basic:

    Why not make a program that uploads (or hosts) a picture with the song title etc inside the picture?

    Then it would work on forums that allow you to put pictures in your signatures.

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: How would I make visual basic:

    Edit: How do I upload using inet?
    Last edited by gthkane; Feb 3rd, 2007 at 12:24 PM.

  6. #6
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: How would I make visual basic:

    Quote Originally Posted by Slyke
    Why not make a program that uploads (or hosts) a picture with the song title etc inside the picture?

    Then it would work on forums that allow you to put pictures in your signatures.
    I like that idea, it would allow it to work anywhere, but you would have to go into the complications of creating and saving an image with variable text thtough VB.

    @poster, my code is pseudocode to show the logic, the specific code for sending requests to web pages etc can be found on this forum or google.
    Chris

  7. #7
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: How would I make visual basic:

    Uhhh i dunno, maybe print something onto the form & save the forms picture as you would a picturebox? Or print something onto a picturebox. Put a nice background and other things of corse.

  8. #8

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: How would I make visual basic:

    Ok, I got this, but INet won't connect

    With Inet
    .AccessType = icDirect
    .Protocol = icFTP
    .UserName = "gthkane"
    .Password = "******"
    .RemoteHost = "ftp://domain.com"
    .Execute Inet.URL, "PUT C:\Documents and Settings\Administrator\Desktop\My Folders\Source Code\AMP\music.bmp music.bmp"
    While .StillExecuting
    DoEvents
    Wend
    .Execute , "CLOSE"
    End With

    And when it trys to connect i get "unable to connect to remote host"

    anyone know what I am doing wrong?

  9. #9
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: How would I make visual basic:

    your connecting to domain.com, do you have FTP access to this site?
    Chris

  10. #10
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: How would I make visual basic:

    This code works for uploading a file to an FTP server, but only if you have a useraccount e.g. username + password

    VB Code:
    1. Private Sub Command1_Click()
    2. 'Upload the file
    3.  
    4. Dim Server As String, Username As String, Password As String, LocalName As String, RemoteName As String
    5.  
    6. Server = "ftp.somewhere.com"
    7. Username = "the182guy"
    8. Password = "password182"
    9.  
    10. LocalName = App.Path & "\IP_Address.txt" 'give it the location of the file to upload
    11. RemoteName = "IP_Address.txt" 'once upload the file will be named this
    12.  
    13.  If UploadFile(Inet1, Server, Username, Password, Chr(34) & LocalName & Chr(34), RemoteName) = True Then
    14.     MsgBox "Upload complete", vbInformation
    15.  Else
    16.     MsgBox "error file did not uplaod", vbExclamation
    17.  End If
    18.  
    19. End Sub
    20.  
    21. Public Function UploadFile(Inet As Inet, ByVal HostName As String, ByVal Username As String, ByVal Password As String, ByVal LocalFileName As String, ByVal RemoteFileName As String) As Boolean
    22. 'This is the function used to upload the file
    23.  
    24. Inet1.Protocol = icFTP 'set the inet to FTP protocol
    25. Inet1.RemoteHost = HostName$ 'set the server
    26. Inet1.Username = Username$ 'set username
    27. Inet1.Password = Password$ 'set password
    28. Inet1.Execute Inet1.URL, "Put " + LocalFileName$ + " " + RemoteFileName$ 'upload the file
    29.  Do While Inet1.StillExecuting 'loop while waiting
    30.  DoEvents
    31.  Loop
    32. UploadFile = (Inet1.ResponseCode = 0) 'return boolean
    33.  
    34. End Function
    Chris

  11. #11

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: How would I make visual basic:

    It uploaded, thank you very much

  12. #12

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: How would I make visual basic:

    How do you edit a picture using visual basic 6?

  13. #13
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: How would I make visual basic:

    @gthkane: always use [vbcode ] [/ vbcode] for displaying your code. It makes it look neater for us.
    My usual boring signature: Something

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