Shutdown

Shutdown

Friday 26 August 2011

Complex and Better way to Shutdown

This way is complex but better.
How ???
When you Shutdown your PC with the help of

System.Diagnostics.Process.Start("shutdown", "/s /t 0");

It can be aborted with the help of :
System.Diagnostics.Process.Start("shutdown", "/a");

But if go this way windows will not be able to abort your shutdown


You will have to import a .dll first

And you can download this dll from:

Shutdown.dll

 now,

I am writting code in c# but you can easily convert into your language, as you know
Dlls are supported by every language supported by .Net Frmework


Note:The only draw back of this way is.. It won't work with limited rights


So,

Project-->Add reference-->Browse--> shutdown.dll

Now just copy underneath code in Your windows app,


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using Shutdown;

namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

Turn_off to = new Turn_off();

to.Turning_off();

}

}

}

No comments:

Post a Comment