3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C#程式重新開機(程式重啟,非系統重啟)   資料來源: https://harde.org/blog/2009/08/c程序重新启动(程序重启,非系统重启).html   //重啟程式 private void Restart() { System.Threading.Thread thtmp = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(run)); object appName = Application.ExecutablePath; System.Threading.Thread.Sleep(2000); thtmp.Start(appName); } private void run(Object obj) { System.Diagnostics.Process ps = new System.Diagnostics.Process(); ps.StartInfo.FileName = obj.ToString(); ps.Start(); } 調用也很簡單 private void btn_restart_Click(object sender, EventArgs e) { Application.ExitThread(); Restart(); }    

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦