Und noch ne nette Sache: Gibt dir die prozentuale Verfügbarkeit wie beim Befehl sh server zurück
Const Button = "Server Latency"
Const APIModule = "NNOTES" ' Windows
Declare Function NSFGetServerLatency Lib APIModule Alias "NSFGetServerLatency" _
( Byval S As String, Byval T As Long, A As Long, B As Long, V As Integer) As Integer
Declare Function NSPingServer Lib APIModule Alias "NSPingServer" _
( Byval S As String, L As Long, pC As Long) As Integer
Declare Function OSLoadString Lib APIModule Alias "OSLoadString" _
( Byval H As Long, Byval S As Integer, Byval B As String, Byval nB As Integer) As Integer
Sub Click(Source As Button)
s$ = Trim$(Inputbox$("Server name:", Button, ""))
If s$ = "" Then Exit Sub
v% = NSPingServer(s$, a&, 0)
If Not v% = 0 Then
APIError v%
Exit Sub
End If
v% = NSFGetServerLatency(s$, 30000, tC&, tS&, sV%)
If Not v% = 0 Then
APIError v%
Exit Sub
End If
Messagebox "Server: " & s$ _
& Chr$(10) & "Availability: " & Cstr(a&) & "%" _
& Chr$(10) & "Outbound: " & Cstr(tC&) & " ms" _
& Chr$(10) & "Inbound: " & Cstr(tS&) & " ms" _
& Chr$(10) & "Version: " & Cstr(sV%) _
, 64, Button
End Sub
Sub APIError(V As Integer)
m$ = String$(1024, " ")
OSLoadString 0, V And &H3FFF, m$, 1024
p% = Instr(m$, Chr$(0))
If Not p% = 0 Then m$ = Left$(m$, p% - 1)
If m$ = "" Or m$ = "No error" Then m$ = "Unknown error (&H" & Hex$(v%) & ")"
Messagebox m$, 16, Button
End Sub
eknori