Newsgroup: it.comp.lang.visual-basic
Titolo: Connessione Accesso Remoto - RasSetEntryProperties

Ciao a tutti.
Devo creare da codice una connessione di Accesso Remoto esclusivamente su
macchine Win98.
Purtroppo la RasSetEntryProperties  continua a restituire l'errore 87. 
Alcuni dicono che questa API funziona solo su NT, e che il primo parametro deve
indicare il PhoneBook ma nell'SDK è specificato che in W98 bisogna mettere come
parametro VbNull. La struttura mi sembra corretta (1768 byte) ed è quella
specifica per W98.
Qualcuno potrebbe dirmi dove cercare l'errore, per favore?
Grazie anticipate...
Ciccio
' Questo è il codice del pulsante
Dim RASStruct As RASENTRY
Dim lngRet As Long
Dim lngEntrySize As Long
Dim lngDeviceSize As Long
lngEntrySize = 0
lngDeviceSize = 0
lngRet = RasGetEntryProperties(vbNullString, "", 0, lngEntrySize, 0,
lngDeviceSize)
If lngRet = ERROR_BUFFER_TOO_SMALL Then
   RASStruct.dwSize = lngEntrySize
   lngRet = RasGetEntryProperties(vbNullString, "", RASStruct,_
                         lngEntrySize, ByVal 0&, ByVal 0&)
End If
  With RASStruct
          Call lstrcpy(.szLocalPhoneNumber(0), "12345678")
          Call lstrcpy(.szDeviceType(0), "modem" & Chr(0))
          Call lstrcpy(.szDeviceName(0), "Digicom CCM 44 P")
     End With
  pippo = RasValidateEntryName(Chr(0), "Connessione")
lngRet = RasSetEntryProperties(Chr(0), ByVal "Connessione" & Chr(0),_
                ByVal RASStruct, ByVal lngEntrySize, ByVal 0&, ByVal 0&)
'Codice del modulo
Const RAS_MaxAreaCode = 10
Const RAS_MaxPhoneNumber = 128
Const RAS_MAX_PATH = 260
Const RAS_MaxDeviceType = 16
Const RAS_MaxDeviceName = 128
Const RAS_MaxPadType = 32
Const RAS_MaxX25Address = 200
Const RAS_MaxFacilities = 200
Const RAS_MaxUserData = 200
Const MAX_PATH = 260
Const ERROR_BUFFER_TOO_SMALL = 603
Type RASIPADDR
    classA As Byte
    classB As Byte
    classC As Byte
    classD As Byte
End Type
Type RASENTRY
   dwSize As Long
   dwfOptions As Long
   dwCountryID As Long
   dwCountryCode As Long
   szAreaCode(RAS_MaxAreaCode) As Byte
   szLocalPhoneNumber(RAS_MaxPhoneNumber) As Byte
   dwAlternatesOffset As Long
   ipaddr As RASIPADDR
   ipaddrDns As RASIPADDR
   ipaddrDnsAlt As RASIPADDR
   ipaddrWins As RASIPADDR
   ipaddrWinsAlt As RASIPADDR
   dwFrameSize As Long
   dwfNetProtocols As Long
   dwFramingProtocol As Long
   szScript(MAX_PATH) As Byte
   szAutodialDll(MAX_PATH) As Byte
   szAutodialFunc(MAX_PATH) As Byte
   szDeviceType(RAS_MaxDeviceType) As Byte
   szDeviceName(RAS_MaxDeviceName) As Byte
   szX25PadType(RAS_MaxPadType) As Byte
   szX25Address(RAS_MaxX25Address) As Byte
   szX25Facilities(RAS_MaxFacilities) As Byte
   szX25UserData(RAS_MaxUserData) As Byte
   dwChannels As Long
   dwReserved1 As Long
   dwReserved2 As Long
End Type
Public Declare Function RasSetEntryProperties Lib "Rasapi32.dll" Alias
"RasSetEntryPropertiesA" (ByVal lpszPhonebook As String, ByVal lpszEntry As
String, lpRasEntry As Any, lpdwEntryInfoSize As Long, lpbDeviceInfo As Any,
lpdwDeviceInfoSize As Long) As Long
Public Declare Function RasGetEntryProperties Lib "Rasapi32.dll" Alias
"RasGetEntryPropertiesA" (ByVal lpszPhonebook As String, ByVal lpszEntry As
String, lpRasEntry As Any, lpdwEntryInfoSize As Long, lpbDeviceInfo As Any,
lpdwDeviceInfoSize As Long) As Long
Public Declare Function RasValidateEntryName Lib "Rasapi32.dll" Alias
"RasValidateEntryNameA" (lpszPhonebook As String, ByVal lpszEntry As String) As
Long
Public Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (lpString1 As
Any, ByVal lpString2 As String) As Long
-- 
Posted from  [212.210.32.2] 
via Mailgate.ORG Server - 
http://www.Mailgate.ORG

Qualcuno potrebbe dirmi dove cercare l'errore, per favore?
DAi un'occhiata sul mio sito.
Ciao,
Moreno
-- 
sirri at morenosoft dot com
Moreno Sirri VB Site - 
http://www.msvbsite.net
---------------------------------------------------------------------------
Le risposte alle tue domande le trovi sul Sito Comune di questo NewsGroup:
 
http://www.it-lang-vb.net
---------------------------------------------------------------------------

 Moreno
Ti ringrazio moltissimo per avermi risposto, sei stato davvero gentile.
Ciao
Alex "Ciccio"
