This will also work from Win98 where netremotetod api will not.Just paste this into a form with a command button and change the ServerIp string to the ip address of your server.
Private Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "Kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400
Private Sub ShellWait(ByVal JobToDo As String)
Dim hProcess As Long
Dim RetVal As Long
hProcess = OpenProcess(PROCESS_QUERY_
Do
GetExitCodeProcess hProcess, RetVal
DoEvents: Sleep 100
Loop While RetVal = STILL_ACTIVE
End Sub
Private Sub Command1_Click()
Dim ServerIp As String, Ln As String
Dim ff As Integer
ServerIp = "192.168.1.100"
ShellWait "command.com /c net time \\" & ServerIp & " > C:\time.tmp"
ff = FreeFile
Open "C:\time.tmp" For Input As #ff
Do Until EOF(ff)
Line Input #ff, Ln
If InStr(Ln, "Current") > 0 Then
MsgBox Ln
End If
Loop
Close #ff
End Sub
Main Topics
Browse All Topics





by: EDDYKTPosted on 2003-05-16 at 05:12:30ID: 8539768
try this
code/netwo rk/netremo tetod.htm
http://www.mvps.org/vbnet/