buckingd
asked on
Using NetRemoteTOD
I have been trying to get NetRemoteTOD working in VB. There was a question about it here before but I still can't seem to get it to work. I'm using VB5. I get a large number out for "elapsed" but nothing else. Everything else is zeros. Any ideas?
Type TIME_OF_DAY_INFO
tod_elapsedt As Long '/* time from 1-1-1970 in seconds */
tod_msecs As Long '/* milliseconds */
tod_hours As Long '/* hours */
tod_mins As Long '/* minutes */
tod_secs As Long '/* seconds */
tod_hunds As Long '/* hundredths */
tod_timezone As Long '/* time zone in minutes from GMT */
tod_tinterval As Long '/* timer interval (units = 0.0001 sec) */
tod_day As Long '/* day */
tod_month As Long '/* month */
tod_year As Long '/* year */
tod_weekday As Long '/* day of week */
End Type
Declare Function NetRemoteTOD Lib "NETAPI32.DLL" (ByVal pszServer As String _
, pbBuffer As TIME_OF_DAY_INFO) As Long
Sub Main()
Dim tTime As TIME_OF_DAY_INFO
Dim lLength As Long
Dim lReturn As Long
Dim swServername As String
lLength = Len(tTime)
sServername = ""
lReturn = NetRemoteTOD(sServername, tTime)
Debug.Print "lReturn=" & lReturn
Debug.Print "Elapsed = " & tTime.tod_elapsedt
Debug.Print "Milliseconds= " & tTime.tod_msecs
Debug.Print "Hours = " & tTime.tod_hours
Debug.Print "Minutes = " & tTime.tod_mins
Debug.Print "Seconds = " & tTime.tod_secs
Debug.Print "Hundreds = " & tTime.tod_hunds
Debug.Print "Time Zone = " & tTime.tod_timezone
Debug.Print "Time Interval = " & tTime.tod_tinterval
Debug.Print "Day = " & tTime.tod_day
Debug.Print "Month = " & tTime.tod_month
Debug.Print "Year = " & tTime.tod_year
Debug.Print "Weekday = " & tTime.tod_weekday
End Sub
Type TIME_OF_DAY_INFO
tod_elapsedt As Long '/* time from 1-1-1970 in seconds */
tod_msecs As Long '/* milliseconds */
tod_hours As Long '/* hours */
tod_mins As Long '/* minutes */
tod_secs As Long '/* seconds */
tod_hunds As Long '/* hundredths */
tod_timezone As Long '/* time zone in minutes from GMT */
tod_tinterval As Long '/* timer interval (units = 0.0001 sec) */
tod_day As Long '/* day */
tod_month As Long '/* month */
tod_year As Long '/* year */
tod_weekday As Long '/* day of week */
End Type
Declare Function NetRemoteTOD Lib "NETAPI32.DLL" (ByVal pszServer As String _
, pbBuffer As TIME_OF_DAY_INFO) As Long
Sub Main()
Dim tTime As TIME_OF_DAY_INFO
Dim lLength As Long
Dim lReturn As Long
Dim swServername As String
lLength = Len(tTime)
sServername = ""
lReturn = NetRemoteTOD(sServername, tTime)
Debug.Print "lReturn=" & lReturn
Debug.Print "Elapsed = " & tTime.tod_elapsedt
Debug.Print "Milliseconds= " & tTime.tod_msecs
Debug.Print "Hours = " & tTime.tod_hours
Debug.Print "Minutes = " & tTime.tod_mins
Debug.Print "Seconds = " & tTime.tod_secs
Debug.Print "Hundreds = " & tTime.tod_hunds
Debug.Print "Time Zone = " & tTime.tod_timezone
Debug.Print "Time Interval = " & tTime.tod_tinterval
Debug.Print "Day = " & tTime.tod_day
Debug.Print "Month = " & tTime.tod_month
Debug.Print "Year = " & tTime.tod_year
Debug.Print "Weekday = " & tTime.tod_weekday
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.