最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#實(shí)現(xiàn)控制Windows系統(tǒng)關(guān)機(jī)、重啟和注銷的方法

 更新時(shí)間:2015年04月14日 09:25:10   作者:令狐不聰  
這篇文章主要介紹了C#實(shí)現(xiàn)控制Windows系統(tǒng)關(guān)機(jī)、重啟和注銷的方法,涉及C#調(diào)用windows系統(tǒng)命令實(shí)現(xiàn)控制開機(jī)、關(guān)機(jī)等操作的技巧,非常簡單實(shí)用,需要的朋友可以參考下

本文實(shí)例講述了C#實(shí)現(xiàn)控制Windows系統(tǒng)關(guān)機(jī)、重啟和注銷的方法。分享給大家供大家參考。具體分析如下:

使用.NET和C#.NET,我們可以對當(dāng)前PC執(zhí)行關(guān)機(jī),重啟,注銷操作。

NET Framework中,有一個(gè)命名空間System.Diagnostics具有所需的類和方法,從當(dāng)前PC上運(yùn)行.NET應(yīng)用程序來執(zhí)行這些操作。
請使用下面的按鈕來執(zhí)行關(guān)機(jī),重啟和注銷。

下面是一個(gè)winform程序

//SHUT DOWN
protected void btnShutDown_Click(object sender, EventArgs e)
{    
 Process.Start("shutdown.exe", "-s");
 // By Default the Shutdown will take place after 30 Seconds
 //if you want to change the Delay try this one
 Process.Start("shutdown.exe","-s -t xx");
 //Replace xx with Seconds example 10,20 etc
}

//RESTART
protected void btnRestart_Click(object sender, EventArgs e)
{
 Process.Start("shutdown.exe", "-r");
 // By Default the Restart will take place after 30 Seconds
 //if you want to change the Delay try this one
 Process.Start("shutdown.exe","-r -t 10");
 //Replace xx with Seconds example 10,20 etc
}

// LOG OFF
protected void btnLogOff_Click(object sender, EventArgs e)
{
 Process.Start("shutdown.exe", "-l");
 //This Code Will Directly Log Off the System Without warnings
}

希望本文所述對大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論

梓潼县| 天等县| 宜丰县| 吉首市| 大姚县| 灵台县| 西昌市| 泸定县| 阳西县| 古浪县| 三原县| 宾川县| 灵山县| 莲花县| 沁水县| 军事| 成都市| 郧西县| 嘉荫县| 阿瓦提县| 出国| 富锦市| 五家渠市| 潮州市| 广宗县| 乌兰县| 无棣县| 泌阳县| 张家川| 宣恩县| 永春县| 镇安县| 镇原县| 临邑县| 长白| 新安县| 海林市| 收藏| 临猗县| 贡嘎县| 长武县|