机器启动表格 [英] Form on Startup of machine

查看:83
本文介绍了机器启动表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示PC启动或重新启动时应打开的表单.
任何有代码的人都将其转发.
预先感谢.

解决方案

最简单的解决方案是将exe的快捷方式移到开始菜单中的启动文件夹中.


<您需要在启动时使用注册表来运行程序.您可以使用System.Win32名称空间中的RegistryKey 类.以下代码显示了如何执行此操作:

 RegistryKey rk = Registry.CurrentUser;
RegistryKey StartupPath;
StartupPath = rk.OpenSubKey( @" 为真);
如果(StartupPath.GetValue(" )== )
{
    StartupPath.SetValue(" ,Application.ExecutablePath,RegistryValueKind.ExpandString);
} 



注意:RegistryKeySystem.Win32名称空间中,因此请不要忘记导入它.

请参阅:在启动时运行程序 [ ^ ]

另一个简单的解决方案是创建具有星型属性true的安装项目....

:)开心的求爱


I want to show the form that should get open when pc get started or restarted.
any one having code pls forward it.
Thanks in advance.

解决方案

The simplest solution is to just move the shortcut of the exe in the startup folder in start menu.


You need to use the Registry for running a program at startup. You can use the RegistryKey class that''s in the System.Win32 namespace. The following code shows how to do this:

RegistryKey rk = Registry.CurrentUser;
RegistryKey StartupPath;
StartupPath = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
if (StartupPath.GetValue("ProjectName") == null)
{
    StartupPath.SetValue("ProjectName", Application.ExecutablePath, RegistryValueKind.ExpandString);
}



Note: RegistryKey is in the System.Win32 namespace, hence don''t forget to import it.

Refer: Running a program at startup[^]


another simple solution is create setup project with star up properties true....

:) happy Coading


这篇关于机器启动表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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