En fait ton programe doit detecter une connexion internet.
Cela signifie qu'au démarrage de windows, ton programme se charge et une fois windows ouvert, detecte quand il y a connexion.
Pour que ton programme se charge au démarrage, sous WinXX, tu peux creer une entree dans la base de registre :
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
nom : ton programme
donnée : app.path\ton prog.exe
POUR DETECTER UNE CONNEXION, creer un module dans ton programme et insere le code qui suit :
Option Explicit
' *********************************************************
' declarations Api
' pour la detection de connexion
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
' detection connexion
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)
main.test1.Text = TRasCon(0).hRasCon
If Tstatus.RasConnState = &H2000 Then
IsConnected = True
Else
IsConnected = False
End If
End Function
DANS TA FEUILLE PRINCIPALE, tu rajoutes un timer puis le code :
cs_charleshenri
Messages postés32Date d'inscriptionlundi 16 août 2004StatutMembreDernière intervention12 février 2006 29 août 2004 à 12:05
Salut Manthis stp j'ai un pb avec ton code la :
main.test1.Text = TRasCon(0).hRasCon il me dit:
Variable non defini pourrer tu me dir ce que je dois faire merci d'avance