启动计算机时如何启动Windows应用程序. [英] how to start the windows application when we starts the computer.

查看:92
本文介绍了启动计算机时如何启动Windows应用程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动计算机时如何启动Windows应用程序?

在我的应用程序中,我想更新当前日期&时间在注册表中.

How do we start the windows application when we start the computer?

In my application I want to update the current date & time in registry.

推荐答案

有一些方法可以做到这一点-

1)在开始\启动文件夹中放置应用程序的快捷方式.
2)创建Windows服务以更新日期和时间.
There are some ways to do this -

1) Place a shortcut to your application in the start \ startup folder.
2) Create a windows service to update the date and time.


在此处查看以下出色的答案:^ ]
Check out these excellent answers here : http://www.codeproject.com/Answers/151824/How-to-run-a-program-at-startup.aspx[^]


public void SetStartup(bool start)
       {
           RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
           if (start)
               rk.SetValue(Path.GetFileName(Application.ExecutablePath).Replace(".exe", ""), Application.ExecutablePath.ToString());
           else
               rk.DeleteValue(Path.GetFileName(Application.ExecutablePath).Replace(".exe", ""), false);
       }
Try This function.And Add "using Microsoft.Win32"


这篇关于启动计算机时如何启动Windows应用程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆