Private Sub Form_Load() Dim sTextLignes As String sTextLignes = "" MSFlexGrid1.RowHeight(1) = 1500 MSFlexGrid1.ColWidth(1) = 2500 MSFlexGrid1.WordWrap = True For i = 1 To 3 sTextLignes = sTextLignes & "Ligne n°" & i & vbCr Next MSFlexGrid1.TextMatrix(1, 1) = sTextLignes End Sub
Private Sub Command1_Click() Label2.Caption = "Surveillance Active" Label2.BackColor = &H80FF80 Rs1.Open "select adresse_ip, NOM_CELLULE from serveur", cnn, adOpenKeyset, adLockOptimistic If Rs1.RecordCount > 0 Then j = 1 Rs1.AbsolutePosition = 1 MSFlexGrid1.Row = 0 MSFlexGrid1.Col = 0 Do While Not Rs1.EOF MSFlexGrid1.TextMatrix(1, j) = Rs1.Fields("adresse_ip") MSFlexGrid1.TextMatrix(2, j) = Rs1.Fields("NOM_CELLULE") 'Get the sockets ready. If SocketsInitialize() Then 'Address to ping strIPAddress = MSFlexGrid1.TextMatrix(1, j) 'Ping the IP that is passing the address and get a reply. lngSuccess = ping(strIPAddress, Reply) 'Display the results. Debug.Print "Address to Ping: " & strIPAddress Debug.Print "Raw ICMP code: " & lngSuccess Debug.Print "Ping Response Message : " & EvaluatePingResponse(lngSuccess) Debug.Print "Time : " & Reply.RoundTripTime & " ms" 'Clean up the sockets. SocketsCleanup Else 'Winsock error failure, initializing the sockets. Debug.Print WINSOCK_ERROR End If With MSFlexGrid1 .FillStyle = flexFillRepeat .Col = j .Row = 0 .ColAlignment(j) = 4 .RowHeight(0) = 1000 If EvaluatePingResponse(lngSuccess) = "Success!" Then Set .CellPicture = LoadPicture("c:\application PFE\serveur1.jpg") Else Set .CellPicture = LoadPicture("c:\application PFE\serveur2.jpg") End If End With j = j + 1 Rs1.MoveNext Loop End If Rs1.Close