|
-
Feb 3rd, 2007, 11:03 AM
#1
Thread Starter
Member
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?
-
Feb 3rd, 2007, 11:21 AM
#2
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
-
Feb 3rd, 2007, 12:05 PM
#3
Thread Starter
Member
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?
-
Feb 3rd, 2007, 12:07 PM
#4
Fanatic Member
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.
-
Feb 3rd, 2007, 12:14 PM
#5
Thread Starter
Member
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.
-
Feb 3rd, 2007, 12:15 PM
#6
Re: How would I make visual basic:
 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.
-
Feb 3rd, 2007, 12:16 PM
#7
Fanatic Member
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.
-
Feb 3rd, 2007, 12:38 PM
#8
Thread Starter
Member
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?
-
Feb 3rd, 2007, 12:57 PM
#9
Re: How would I make visual basic:
your connecting to domain.com, do you have FTP access to this site?
-
Feb 3rd, 2007, 01:00 PM
#10
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:
Private Sub Command1_Click()
'Upload the file
Dim Server As String, Username As String, Password As String, LocalName As String, RemoteName As String
Server = "ftp.somewhere.com"
Username = "the182guy"
Password = "password182"
LocalName = App.Path & "\IP_Address.txt" 'give it the location of the file to upload
RemoteName = "IP_Address.txt" 'once upload the file will be named this
If UploadFile(Inet1, Server, Username, Password, Chr(34) & LocalName & Chr(34), RemoteName) = True Then
MsgBox "Upload complete", vbInformation
Else
MsgBox "error file did not uplaod", vbExclamation
End If
End Sub
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
'This is the function used to upload the file
Inet1.Protocol = icFTP 'set the inet to FTP protocol
Inet1.RemoteHost = HostName$ 'set the server
Inet1.Username = Username$ 'set username
Inet1.Password = Password$ 'set password
Inet1.Execute Inet1.URL, "Put " + LocalFileName$ + " " + RemoteFileName$ 'upload the file
Do While Inet1.StillExecuting 'loop while waiting
DoEvents
Loop
UploadFile = (Inet1.ResponseCode = 0) 'return boolean
End Function
-
Feb 3rd, 2007, 01:07 PM
#11
Thread Starter
Member
Re: How would I make visual basic:
It uploaded, thank you very much
-
Feb 3rd, 2007, 01:21 PM
#12
Thread Starter
Member
Re: How would I make visual basic:
How do you edit a picture using visual basic 6?
-
Feb 3rd, 2007, 02:15 PM
#13
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|