Click here to Skip to main content
11,649,312 members (82,078 online)
Click here to Skip to main content

ShutDown Timer

, 12 Aug 2006 CPOL 43.3K 2K 23
Rate this:
Please Sign up or sign in to vote.
Set timer to Turn Off your PC

Interface

Introduction

Before going in detail about the application.

This simple programme help you if you want to set timer to turn off your PC after spacified period.

Core behined Code

The most important code in this programme

System.Diagnostics.Process.Start("Shutdown", "/s")

I pass ' Shutdown ' to turn off .

So how am I achieving it? (What is the code behind it?)

first I used timer of course to increese variables every Tick of timer :-

This snap shot of code

this global var
Dim x,min,cou,hh As Integer = 0


Private Sub Timer1_Tick

'For each tick

'here I make counter

'x second

x = x + 1

If x = 60 Then

x = 0

min = min + 1

ProgressBar1.Value = ProgressBar1.Value + 1

End If

If min = 60 Then

hh += 1

min = 0

End If

Label5.Text = hh

'to display the timer

Label4.Text = x

Label3.Text = min

'NumericUpDown1 Input of hour

'NumericUpDown1 Input of hour
'NumericUpDown1 Input of hour

Dim tothor As Integer = Int32.Parse(NumericUpDown1.Value)

Dim totmin As Integer = Int32.Parse(NumericUpDown2.Value)

tothor = tothor * 60

Dim total As Double = tothor + totmin

'every tick check if it we achieve total of Minute

Dim totallabel As Double = hh * 60 + min

If totallabel = total Then

cou += 1

wa()

End If

End Sub

Now You can shut down

This sub shutdown pc

Public Sub wa()

If cou = 1 Then

Me.Show()

System.Diagnostics.Process.Start("Shutdown", "/s")

cou += 1

End If

End Sub

Finaly

pop up window will show give 30 second before shutting down.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Amr M. K.
Web Developer
Jordan Jordan
- Need is the mother of the invitation .
- To be acknowledge is matter of time..
be skillfull..needs...

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
Muhammady18-Mar-12 10:49
memberMuhammady18-Mar-12 10:49 
GeneralMy vote of 5 Pin
versx1-Aug-10 21:37
memberversx1-Aug-10 21:37 
Joke:( Pin
The_Mega_ZZTer13-Aug-06 9:02
memberThe_Mega_ZZTer13-Aug-06 9:02 
GeneralRe: :(hi [modified] Pin
mr.stick13-Aug-06 23:23
membermr.stick13-Aug-06 23:23 
Generalhe meant logoff Pin
Fabse_net14-Aug-06 4:02
memberFabse_net14-Aug-06 4:02 
GeneralRe: he meant logoff Pin
mr.stick14-Aug-06 8:10
membermr.stick14-Aug-06 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150804.4 | Last Updated 13 Aug 2006
Article Copyright 2006 by Amr M. K.
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid