RasDial + Error

jsmeiway Messages postés 32 Date d'inscription mardi 24 août 2004 Statut Membre Dernière intervention 9 septembre 2005 - 9 sept. 2004 à 14:06
jsmeiway Messages postés 32 Date d'inscription mardi 24 août 2004 Statut Membre Dernière intervention 9 septembre 2005 - 13 nov. 2004 à 08:45
Bonjour,

J'ai récupéré une fontion avec l'api RasApi32.dll
qui récupère les connexions en cours,
j'ai trouvé des exemples de connexion pour gérer les erreurs mais je n'y arrive pas
comment puis-je récupérer les erreur 691 (mauvais login/pass),769(mauvais phone)
'Private Const RAS_MaxEntryName 256
Private Const RAS_MaxDeviceName = 128
Private Const RAS_MaxDeviceType = 16

Private Type RASCONN95
dwSize As Long
hRasConn As Long
szentryname(RAS_MaxEntryName) As Byte
szDeviceName(RAS_MaxDeviceName) As Byte
szDeviceType(RAS_MaxDeviceType) As Byte
End Type
Private Type RASENTRYNAME
dwSize As Long
szentryname(RAS_MaxEntryName) As Byte
End Type
Private Type RASDEVINFO
dwSize As Long
szDeviceName(RAS_MaxDeviceName) As Byte
szDeviceType(RAS_MaxDeviceType) As Byte
End Type
Private Declare Function RasEnumDevices Lib "RasApi32.dll" Alias "RasEnumDevicesA" (lprasdevinfo As Any, lpcb As Long, lpcConnections As Long) As Long
Private Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lprasconn As Any, lpcb As Long, lpcConnections As Long) As Long
Private Declare Function RasEnumEntries Lib "RasApi32.dll" Alias "RasEnumEntriesA" (ByVal reserved As String, ByVal lpszPhonebook As String, lprasentryname As Any, lpcb As Long, lpcEntries As Long) As Long

'Fonction du status de connexion
Private Function RASState() As Boolean
Dim s As Long, l As Long, ln As Long, a$, b$, FichierStatus As String

b$ = LListConnect.List(LListConnect.ListIndex)
ReDim r(255) As RASCONN95
r(0).dwSize = 412
s = 256 * r(0).dwSize
l = RasEnumConnections(r(0), s, ln)
For l = 0 To ln - 1
a$ = StrConv(r(l).szentryname(), vbUnicode)
a$ = Left$(a$, InStr(a$, Chr$(0)) - 1) If a$ b$ Then RASState True: Exit Function
Next
RASState = False
End Function
'==================================

Merci
ps: je ne sias pas trop encore comment fonction toute ces fontions
mytoo vmeiway

2 réponses

cs_galexis Messages postés 40 Date d'inscription jeudi 12 août 2004 Statut Membre Dernière intervention 13 juillet 2006
22 oct. 2004 à 18:47
Je souhaite réaliser un compteur internet différenciant chaque connexion . Ex, connexion1activé: compteur 1 activé; connexion 2 active:compteur2.
Comment utiliser cette procédure, dont je ne comprends rien, dans ce but. Quelle(s) variable(s) de donne l'état des connexions ?
Salutation.
0
jsmeiway Messages postés 32 Date d'inscription mardi 24 août 2004 Statut Membre Dernière intervention 9 septembre 2005
13 nov. 2004 à 08:45
désolé de répondre aussi tard

dans la fonction RASState(), elle te renvoie true si une connexion est en cours ou établie

if rasstate then
...
end if

'ici j'avais donné mon exemple car j'avais une listbox
=========================================
Private Function RASState() As Boolean
Dim s As Long, l As Long, ln As Long, a$, b$, FichierStatus As String

b$ = LListConnect.List(LListConnect.ListIndex)
ReDim r(255) As RASCONN95
r(0).dwSize = 412
s = 256 * r(0).dwSize
l = RasEnumConnections(r(0), s, ln)
For l = 0 To ln - 1
a$ = StrConv(r(l).szentryname(), vbUnicode)
a$ = Left$(a$, InStr(a$, Chr$(0)) - 1)If a$ b$ Then RASState True: Exit Function
Next
RASState = False
End Function
=========================================


tu peux modifier pour vérifier un nom de connection
=========================================
Private Function RASState(nameconnect as string) As Boolean
Dim s As Long, l As Long, ln As Long, a$, b$, FichierStatus As String

b$ = nameconnect
ReDim r(255) As RASCONN95
r(0).dwSize = 412
s = 256 * r(0).dwSize
l = RasEnumConnections(r(0), s, ln)
For l = 0 To ln - 1
a$ = StrConv(r(l).szentryname(), vbUnicode)
a$ = Left$(a$, InStr(a$, Chr$(0)) - 1)If a$ b$ Then RASState True: Exit Function
Next
RASState = False
End Function
=========================================
0
Rejoignez-nous