为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

开机启动代码

2018-10-14 5页 doc 17KB 37阅读

用户头像

is_842972

暂无简介

举报
开机启动代码开机启动代码 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 Microsoft.Win32; namespace ManagerAide { public partial c...
开机启动代码
开机启动代码 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 Microsoft.Win32; namespace ManagerAide { public partial class System : Form { public System() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { RunWhenStart(true, "ÖúÊÖ", @"F:\µÚ?þÑ?ÆÚ\Winform\ÈÕ???ÜÀíÖúÊÖ\ManagerAide\ManagerAide\bin\Debug\ManagerAide.exe"); //µ?ÓÃ???Å ???ÌÐòÃûÒÔ??Â??? } //ʵÏÖ?ª?ú×ÔÆô????ÄÜ??????Ö??ÓÊ?ÓÃÏÂÃæµÄ???Å?Í?ÉÒÔ public void RunWhenStart(bool Started, string name, string path) { RegistryKey HKLM = Registry.LocalMachine; //×??á?í RegistryKey Run = HKLM.CreateSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\"); try { Run.SetValue(name, path); //?æ?øÈ? HKLM.Close(); MessageBox.Show("ÒÑ?É??ÉèÖÃ?ª?ú×ÔÆô??"); } catch (System.Exception ex) { MessageBox.Show("×??á?íÐÞ?Ä?íÎó??Î?ʵÏÖ?ª?ú×ÔÆô??"); } } private void button2_Click(object sender, EventArgs e) { closeWhenStart(); } //?Ø?Õ?ª?úÆô?? private void closeWhenStart() { // MessageBox.Show("Ã?ÓÐÑ?ÖÐ"); //?ñÈ??ÌÐòÖ?ÐÐÂ???.. // string starupPath = @"F:\µÚ?þÑ?ÆÚ\Winform\Exercise01\Application1\bin\Debug\Applicatio n1.exe"; //class Micosoft.Win32.RegistryKey. ?íÊ?Window×??á?íÖÐÏî???Úµã,?ËÀàÊÇ×??á?í×?. RegistryKey loca = Registry.LocalMachine; RegistryKey run = loca.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ); try { //SetValue:?æ??ÖµµÄÃû?Æ run.DeleteValue("ÖúÊÖ"); MessageBox.Show("ÒÑÍ?Ö??ª?úÔËÐÐ!", "ÌáÊ?", MessageBoxButtons.OK, MessageBoxIcon.Information); loca.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message.ToString(), "ÌáÊ?", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void button3_Click(object sender, EventArgs e) { int hm = System.Environment.TickCount; double h = hm / 3600000.0; double m = double.Parse("0." + h.ToString("F6").Substring(h.ToString().IndexOf(".") + 1)) * 60; double s = double.Parse("0." + m.ToString("F6").Substring(m.ToString().IndexOf(".") + 1)) * 60; string h1 = ((int)h).ToString(); string m1 = ((int)m).ToString(); string s1 = ((int)s).ToString(); if ((int)h < 10) h1 = "0" + h1; if ((int)m < 10) m1 = "0" + m1; if ((int)s < 10) s1 = "0" + s1; string nowtime = DateTime.Now.TimeOfDay.ToString().Substring(0, 8); string span = h1 + ":" + m1 + ":" + s1; TimeSpan spantime = Convert.ToDateTime(nowtime).Subtract(Convert.ToDateTime(span)); MessageBox.Show("ÄúµÄ?ª?úÊ??äÊÇ?º " + spantime.ToString()); } } }
/
本文档为【开机启动代码】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索