Пример #1
0
        private void RunSys()
        {
            try
            {
                string appPath = Application.ExecutablePath;
                RegistryKey registry = Registry.LocalMachine;

                object hotkey = registry.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\").GetValue("HookKey");

                if (hotkey == null)
                {

                    RegistryKey run = registry.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
                    run.SetValue("HookKey", appPath);
                    run.Close();
                    frmhelp f = new frmhelp();
                    f.Show();

                }
                else
                {

                    if (hotkey.ToString() != appPath)
                    {
                        //RegistryKey run = registry.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
                        //run.SetValue("HookKey", appPath);
                       //run.Close();
                    }

                }

            }
            catch (Exception ex)
            {
                ShowMessage("没有权限设置自动启动!");
            }
        }
Пример #2
0
 private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmhelp f = new frmhelp();
     f.Show();
 }