Page 1 sur 1

ServerStartTime

MessagePublié: 02 Août 2005 à 13:22
par Stephane Maillard
[syntax="ls"]Const wAPIModule = "NNOTES" ' Windows/32

Declare Private Function NSFGetServerStats Lib wAPIModule Alias "NSFGetServerStats" _
( Byval S As String, Byval F As String, Byval N As String, hT As Long, nT As Long) As Integer

Declare Private Function OSLockObject Lib wAPIModule Alias "OSLockObject" _
( Byval H As Long) As Long

Declare Private Sub OSUnlockObject Lib wAPIModule Alias "OSUnlockObject" _
( Byval H As Long)

Declare Private Function OSMemFree Lib wAPIModule Alias "OSMemFree" _
( Byval hM As Long) As Integer

Declare Private Sub PeekString Lib "MSVCRT" Alias "memcpy" _
( Byval D As String, Byval P As Long, Byval N As Long)


Function ServerStartTime(server$) As String
Dim hT As Long
NSFGetServerStats server$, "Server", "Time.Start", hT, nt&
If hT = 0 Then Exit Function

p& = OSLockObject(hT)
t$ = Space(nt&)
PeekString t$, p&, nt&
t$ = Mid$(t$, Instr(t$, Chr$(9)) + 1)
ServerStartTime = Left$(t$, Instr(t$, Chr$(10)) - 1)

OSUnlockObject hT
OSMemFree hT
End Function[/syntax]