|
-
Apr 26th, 2001, 05:12 PM
#1
Thread Starter
Addicted Member
what is wrong with that code
Code:
Private Declare Function RasEnumConnections Lib "rasapi32" Alias "RasEnumConnectionsA" (ByVal lprasconn As Long, ByVal lpcb As Long, ByVal lpcConnections As Long) As Long
Private Declare Function RasGetConnectionStatistics Lib "rasapi32" (ByVal hRasConn As Long, ByVal lpStatistics As Long) As Long
Private Type RASCONN
dwSize As Long
hRasConn As Long
szEntryName(0 To 256) As Byte
szDeviceType(0 To 16) As Byte
szDeviceName(0 To 128) As Byte
pad As Byte
End Type
Private Type RAS_STATS
dwSize As Long
dwBytesXmited As Long
dwBytesRcved As Long
dwFramesXmited As Long
dwFramesRcved As Long
dwCrcErr As Long
dwTimeoutErr As Long
dwAlignmentErr As Long
dwHardwareOverrunErr As Long
dwFramingErr As Long
dwBufferOverrunErr As Long
dwCompressionRatioIn As Long
dwCompressionRatioOut As Long
dwBps As Long
dwConnectDuration As Long
End Type
Private Sub Form_Load()
Dim x As RASCONN
Dim stat As RAS_STATS
Dim y As Long, z As Long
x.dwSize = Len(x)
y = x.dwSize
Debug.Print y
Debug.Print RasEnumConnections(VarPtr(x), VarPtr(y), VarPtr(z))
Debug.Print z
Debug.Print y
Debug.Print StrConv(x.szEntryName, vbUnicode)
Debug.Print StrConv(x.szDeviceType, vbUnicode)
Debug.Print StrConv(x.szDeviceName, vbUnicode)
'i m getting an error below it should return 0 do not know why
Debug.Print RasGetConnectionStatistics(x.hRasConn, VarPtr(stat))
Debug.Print stat.dwBytesRcved
End Sub
-
Apr 26th, 2001, 05:17 PM
#2
Monday Morning Lunatic
Since I couldn't test it earlier I didn't notice, but do this before you call the function:
Code:
stat.dwSize = Len(stat)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|