dvplayltd
asked on
How to start time synchronize process via VB6?
Hi experts!
I’m interesting, how can I force programmatically via VB6 a computer with Windows 2008 Server, XP,Win7 Pro to synchronizer the clock with Internet server used already ready setting in Windows? Also will be good if I’m able to get notify that operation is finish, but this is not a must. I can simple wait 1 min. and then to pass my commands
.
I’m interesting, how can I force programmatically via VB6 a computer with Windows 2008 Server, XP,Win7 Pro to synchronizer the clock with Internet server used already ready setting in Windows? Also will be good if I’m able to get notify that operation is finish, but this is not a must. I can simple wait 1 min. and then to pass my commands
.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is no API i am aware of, and implementing your own NTP client
(like "Simple Network Time Protocol Client" http://www.dataman.ro/?page_id=39)
may be a bit of overkill for your application.
(like "Simple Network Time Protocol Client" http://www.dataman.ro/?page_id=39)
may be a bit of overkill for your application.
ASKER
OK ..look that I'll take you first offer.
By the way, let me ask, can I use this tool to remove auto time synchro in Windows ?
I mean if I manual via GID intreface turn off time sinchor it appears that again it is done.
So question is: how to turn off auto time sycnhro of time inder XP and Win 7 ?
By the way, let me ask, can I use this tool to remove auto time synchro in Windows ?
I mean if I manual via GID intreface turn off time sinchor it appears that again it is done.
So question is: how to turn off auto time sycnhro of time inder XP and Win 7 ?
ASKER
And last clarigy question:
I found this decr:
/resync [{:ComputerName] [/nowait]|[/rediscover}] : Resynchronize the clock as soon as possible, disregarding all accumulated error statistics. If no computer is specified, the local computer will resynchronize. The command will wait for resynchronization unless the /nowait switch is used. Currently used time resources will be used unless /rediscover is used, which will force redetection of network resourced before resynchronization.
It look to me that I should use this, correct???
Shell "c:\WINDOWS\system32\w32tm .exe /resync /nowait", vbHide
I need set clock time to be done right away and after 10 sec. to contunie my operation with used correct current time
I found this decr:
/resync [{:ComputerName] [/nowait]|[/rediscover}] : Resynchronize the clock as soon as possible, disregarding all accumulated error statistics. If no computer is specified, the local computer will resynchronize. The command will wait for resynchronization unless the /nowait switch is used. Currently used time resources will be used unless /rediscover is used, which will force redetection of network resourced before resynchronization.
It look to me that I should use this, correct???
Shell "c:\WINDOWS\system32\w32tm
I need set clock time to be done right away and after 10 sec. to contunie my operation with used correct current time
"/nowait – do not wait for the resynchronize to occur; return immediately. Otherwise, wait for the resynchronize to complete before returning."
If you use /nowait you have to "manually" wait or check the event log
use the optional "wait" argument (true/false) and timeout (milisec.)
e.g.
Shell "c:\WINDOWS\system32\w32tm .exe /resync /nowait", vbHide , True, 5000
If you use /nowait you have to "manually" wait or check the event log
use the optional "wait" argument (true/false) and timeout (milisec.)
e.g.
Shell "c:\WINDOWS\system32\w32tm
Sorry - copy/paste error :-)
of course you can't use /nowait if you wan to wait 5sec max
Shell "c:\WINDOWS\system32\w32tm .exe /resync", vbHide , True, 5000
of course you can't use /nowait if you wan to wait 5sec max
Shell "c:\WINDOWS\system32\w32tm
ASKER
Hyyym. I think that use no wait and to start my next code after 5 sec. will be better. WHat will happen if for example file w32t,exe is missing or by some reason stop and wait a answer to question? I think that in this situation my code will block and stop ..
If the program can't be executed, Shell() will return
ASKER
10x. I already put this in my software, it seems to work fine. Thank you very much!
ASKER
Hyym. This is possible solution, however I think there should be API which I may call and which are better manage with my own software.