Code:
Public Function GetStringBetween(ByVal InputText As String, _
ByVal StartText As String, _
ByVal EndText As String, _
Optional ByVal StartPosition = 1) As String
'Standard Function as supplied by Mumei - NOT case sensitive and uses mid, not mid$
Dim lnTextStart As Long
Dim lnTextEnd As Long
lnTextStart = InStr(StartPosition, InputText, StartText, vbTextCompare) + Len(StartText)
lnTextEnd = InStr(lnTextStart, InputText, EndText, vbTextCompare)
If lnTextStart >= (StartPosition + Len(StartText)) And lnTextEnd > lnTextStart Then
'we've found the entry
GetStringBetween = Mid(InputText, lnTextStart, lnTextEnd - lnTextStart)
Else
GetStringBetween = ""
End If
End Function
Private Sub Command1_Click()
WebBrowser1.Navigate ("http://mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=1")
If code = "0" = GetStringBetween(Buffer, "<result code=", "/>") Then
Label3.Caption = "Success!"
Else
Label3.Caption = "Failed."
End If
WebBrowser2.Navigate ("http://mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=2")
If code = "0" = GetStringBetween(Buffer, "<result", "/>") Then
Label4.Caption = "Success!"
Else
Label4.Caption = "Failed."
End If
WebBrowser3.Navigate ("http://www.mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=3")
If code = "0" = GetStringBetween(Buffer, "<result code=", "/>") Then
Label5.Caption = "Success!"
Else
Label5.Caption = "Failed."
End If
End Sub
