1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Private Sub Command1_Click()
Me.Caption = "Recherche IP"
Label1 = "": Label2 = ""
Dim Sortie As Date
Dim READYSTATE_COMPLETE As Integer
READYSTATE_COMPLETE = 4
Dim IExplorer As Object
Set IExplorer = CreateObject("InternetExplorer.application")
Dim Msg$
Msg$ = "http://monip.net/"
On Error Resume Next
Sortie = DateAdd("S", 10, Now) 'ajoute de 10 Sc par apport à l'heure systeme
IExplorer.Navigate Msg$
Do While IExplorer.readyState <> READYSTATE_COMPLETE
DoEvents
Me.Caption = IExplorer.statusText
If Now >= Sortie Then Me.Caption = "delai depassé": Exit Sub
Loop
DoEvents
Dim DocU As String
DocU = IExplorer.document.activeElement.innerText
Dim MeTableau() As String
MeTableau = Split(DocU, vbCrLf)
IExplorer.Quit: DoEvents: Set IExplorer = Nothing
Me.Caption = "Recuperation compléte"
Label1 = MeTableau(2) & " " & MeTableau(3)
Label2 = MeTableau(5)
End Sub |