Results 1 to 2 of 2

Thread: need help connection

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    panama
    Posts
    57

    Post

    who running program with detect if there is an active connection an internet checking automatic the program running in memory,

    and with running my program and not accesing to desactivate with control + alt + supr and press end task (progrma load in start windows and not desactivate)

    thank friends!

    ------------------
    capv

  2. #2
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Post

    Not sure exactly what you're wondering, but
    here's a way to check for internet connection. Place all the fallowing in a module:

    Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
    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

    '**** Determines if there is an internet connection ****
    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


    Then in your code you can do:

    If IsConnected = false then
    msgbox "Not connected to internet."
    end if

    I don't know exactly how this works, I'm still trying to figure it out, someone else gave me that code in this BB about a month ago.

    ------------------
    Micah Carrick
    Ordinary joe with a new found passion for code.
    http://micah.carrick.com
    micah@carrick.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width