简体   繁体   English

c#设置程序以使用注册表启动并在启动时启动,并使用复选框修改选项

[英]c# set a program to launch at startup using registry and a checkbox to modify the option

I know how to tell the registy to run my app on startup. 我知道如何告诉注册管理机构在启动时运行我的应用程序。 There are a lot of threads about it. 关于它有很多线程。 I used this one: How do I set a program to launch at startup . 我使用了这个: 如何设置程序在启动时启动 The problem I face is: I give the user the option to disable/enable this option when the user uninstall, there is a key left in the registry that tells the app to run (although the app was already uninstalled) 我面临的问题是:我为用户提供了在用户卸载时禁用/启用此选项的选项,注册表中还有一个密钥告诉应用程序运行(尽管该应用程序已被卸载)

I know I can handle it by a shortcut in the startup folder, but I tried it already and I have problem with it too. 我知道我可以通过启动文件夹中的快捷方式来处理它,但是我已经尝试过了,并且也遇到了问题。 Thanks Eli 谢谢伊莱

To remove the entry in the registry you should instruct your installation program to remove the registry value. 要删除注册表中的条目,您应该指示安装程序删除注册表值。

If you are using the build in installation project in VS you could do that by implementing the Uninstall event. 如果您在VS中使用内置安装项目,则可以通过实现Uninstall事件来实现。

If it is a click once installation you just have to ignore it. 如果单击安装一次,则只需忽略它。

Simple solution without using Custom Actions I just added a registry Key by the Registry editor until I got to the Run folder and added to it the value "name of my app" (on the right panel) and I didn't wrote a path just left it "" I played with the checkbox (add key, delete key) and even though I left it with the key. 不使用“自定义操作”的简单解决方案,我只是通过注册表编辑器添加了一个注册表项,直到进入“运行”文件夹,并在其中添加了“我的应用程序的名称”值(在右侧面板上),而且我没有写路径留下它“”我玩了复选框(添加键,删除键),即使我留下了键。 when I uninstalled it was gone. 当我卸载它不见了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM