Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confused by Timer.Interval Property...

Status
Not open for further replies.

stephenmbell

IS-IT--Management
Jan 7, 2004
109
US
I am writing an application that will shell out to c:\windows\system32\shutdown.exe

This application will start by scheduled task - 15 minutes before I actually want the machine to reboot.

I have a timer on my form, with an interval of 90000 (which I believe is 15 minutes)

The event does fire, but it seems to fire in under a minute, not the 15 minutes that the interval property is set to.

Below is the code that I wrote, it is surrounded by the formload event and timer tick event that vs.net 2003 automatically did for me.

Any help would be greatly appreciated

sb

On FormLoad:
Code:
        'enable & start the timer
        myTimer.Enabled = True
        myTimer.Start()

MyTimer.Tick Event:
Code:
        Dim strMachine As String = Environment.MachineName
        Dim strCommand As String
        Dim ret As Integer

        'set the command to reboot register
        strCommand = "C:\windows\system32\shutdown.exe -m \\" & strMachine & " -f -t 15 -f"

        ret = Shell(strCommand)
 
The units required are milliseconds so 15 minutes is 900000 not 90000.


Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top