Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Verificare che il pc sia connesso a internet...

    Ciao a tutti come posso verificare se il pc è connesso a internet ???
    Io avrei pensato di controllare la porta 80 e verificare se sia in uso o meno.. ma non so' se è giusto..

    Come potrei fare???

  2. #2
    Foga27News
    Guest
    Questo codice dovrebbe funzonare:
    codice:
    Option Explicit
    
    Public Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
    
    Public Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
           Public Const RAS95_MaxEntryName = 256
           Public Const RAS95_MaxDeviceType = 16
           Public Const RAS95_MaxDeviceName = 32
    
    Public Type RASCONN95
           dwSize As Long
           hRasCon As Long
           szEntryName(RAS95_MaxEntryName) As Byte
           szDeviceType(RAS95_MaxDeviceType) As Byte
           szDeviceName(RAS95_MaxDeviceName) As Byte
    End Type
    
    
    Public Type RASCONNSTATUS95
           dwSize As Long
           RasConnState As Long
           dwError As Long
           szDeviceType(RAS95_MaxDeviceType) As Byte
           szDeviceName(RAS95_MaxDeviceName) As Byte
    End Type
    
    Public Function IsConnected() As Boolean
    
           Dim TRasCon(255) As RASCONN95
           Dim lg As Long
           Dim lpcon As Long
           Dim RetVal As Long
           Dim Tstatus As RASCONNSTATUS95
           
           TRasCon(0).dwSize = 412
           lg = 256 * TRasCon(0).dwSize
           
           RetVal = RasEnumConnections(TRasCon(0), lg, lpcon)
    
                  If RetVal <> 0 Then
                         MsgBox "ERROR"
                         Exit Function
                  End If
    
           Tstatus.dwSize = 160
           RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)
    
                If Tstatus.RasConnState = &H2000 Then
                    IsConnected = True
                Else
                    IsConnected = False
                End If
    End Function
    :metallica :metallica

  3. #3
    Grazie mille.. lo provo subito !!!

    :adhone:

  4. #4
    Funzionaaaaaaaa !!!

    Grazieeeeeee

  5. #5
    Utente di HTML.it
    Registrato dal
    Jul 2001
    Messaggi
    798
    Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long



    Dim IsConnected As Boolean

    IsConnected = IIF(InternetGetConnectedState(0&, 0&) = 1, True, False)
    Ans.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.