Log in

View Full Version : Coke studios status (VB6)


DefectiveProduct
08-18-2006, 02:10 PM
Things you'll need:

6 labels
1 timer
1 textbox
3 inet controls

If you don't know how to draw an inet on your form, hit CTRL+T to bring up the project components. Scroll down and tick the box next to Microsoft Internet Transfer Control and hit Apply. A little icon of a computer and the earth behind it will appear in your toolbar. Click that icon and just draw the inets anywhere on your form.

LEAVE ALL OBJECT NAMES AS DEFAULT. DO NOT CHANGE THEIR NAMES.

Now.

Change the textboxes text to a quotation mark. Just one quotation mark, that's all.

"

And set the textboxes Visible property to FALSE.

Now set your timers interval to 3000 and set it's Enabled property to TRUE.

Arrange your labels in this order

Label1 Label2
Label3 Label4
Label5 Label6

Now change Label1s caption to "Open/Closed:"
Change Label3s caption to "Online:"
And change label5s caption to "Capacity"

For a better look, I would set the font for labels 2, 4 and six to bold. You don't have to, I just think it looks good. For a placeholder, I also made the captions for labels 2, 4 and 6 "Null"

Now your form should look something like this.

http://img390.imageshack.us/img390/8313/status1su5.png

Now insert this code into your timer, and you're finished.

On Error Resume Next 'Just in case.
Dim strCode As String
Dim strCode2 As String
Dim strCode3 As String


' Get the closed/open status
strCode = Inet1.OpenURL("http://cokestudios2.cokemusic.com/sf/status?timestamp=")
strCode = Split(Split(strCode, "SS=" & Text1.Text & "")(1), "" & Text1.Text & " T")(0)
SPLITRESULT = strCode
If InStr(SPLITRESULT, "<") Or strCode = "" Then 'Checks to see if the split performed properly. The < is something you see in alot of failed splits because the failed split gets the entire page of the source. And sometimes failed splits do not get anything at all. Yeah, you get it.
Label2.Caption = "ERROR"
Else ' If the split does not contain the < character and is NOT absolutely nothing, this if function is done to determine whether the studios are open or not
If InStr(strCode, "O") Then
Label2.Caption = "Open"
Else
Label2.Caption = "Closed"
End If
End If


' Get the Online status
strCode2 = Inet2.OpenURL("http://cokestudios2.cokemusic.com/sf/status?timestamp=")
strCode2 = Split(Split(strCode2, "TSO=" & Text1.Text & "")(1), "" & Text1.Text & "")(0)
SPLITRESULT2 = strCode2
If InStr(SPLITRESULT2, "<") Or SPLITRESULT2 = "" Then
Label4.Caption = "ERROR"
Else
Label4.Caption = SPLITRESULT2
End If


'Get the capacity status
strCode3 = Inet3.OpenURL("http://cokestudios2.cokemusic.com/sf/status?timestamp=")
strCode3 = Split(Split(strCode3, "TSMC=" & Text1.Text & "")(1), "" & Text1.Text & " SS=")(0)
SPLITRESULT3 = strCode3
If InStr(SPLITRESULT3, "<") Or strCode = "" Then
Label6.Caption = "ERROR"
Else
Label6.Caption = SPLITRESULT3
End If

That's all there is to it.

I would apreciate any comments or suggestions.

Attatched below is a source and example application.

Hope this helps.

Pyro
08-18-2006, 03:34 PM
Good Job ;)
This'll help a few people :)

DefectiveProduct
08-18-2006, 03:46 PM
Yeah, Kyle already used it in his CokeClient v2.

It might also give people an idea of how the very handy split function works.

mayorhacker13
08-18-2006, 06:38 PM
i think that this is not going to help me

Skooled
08-18-2006, 06:54 PM
Defective thanks alot for this :), ive been trying to do this forever. Maybe make a tut on how to make a open and close buttons :D. I already added to my client.

p1nba11
08-18-2006, 07:27 PM
Lol seangreasley.com


Best site. Easy to read.

Thunder_man
08-21-2006, 05:16 AM
Nice job on the tutorial bitch.

Alex-
08-21-2006, 01:08 PM
Not to sound stupid, but what is this used for?

DefectiveProduct
08-21-2006, 01:18 PM
A client or any other Visual Basic program.

Masked
08-21-2006, 03:43 PM
wow this is very cool. how did you find the

strCode = Inet1.OpenURL


http://cokestudios2.cokemusic.com/sf/status?timestamp=

TAG
08-21-2006, 06:37 PM
What the hell does it do?

Masked
08-21-2006, 08:45 PM
it tells you how many people are on coke

darkphaux
08-22-2006, 03:56 AM
wow thank you i hae looked everywere on how to do this