Windows启动时如何运行我的应用程序?

编程入门 行业动态 更新时间:2024-10-24 08:20:14
本文介绍了Windows启动时如何运行我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚刚创建了一个弹出窗口.现在我想在窗口启动时自动运行它.请告诉我该怎么做?

Hi, I just created a pop up window.Now i want to run it automatically when the windows start up.Kindly tell me how to do that?

推荐答案

将您的exe放入以下文件夹.它会在每个srartup上运行.为了进行测试,请重新启动Windows. C:\ Documents and Settings \ Administrator \开始菜单\ Programs \ Startup Put your exe in following folder. it will run at every srartup. For test, restart the windows. C:\Documents and Settings\Administrator\Start Menu\Programs\Startup

为此,您需要创建Windows服务. 简单Windows服务示例 [ ^ ] 如何在C#中开发Windows服务 [ ^ ] For that you need to create windows service. Simple Windows Service Sample[^] How to develop Windows Service in C#[^]

此行将添加用于自动启动的注册表项: This line will add a registry entry for autostart: Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run").SetValue("keyNameForRegistry", "PATH_TO_EXECUTABLE");

并且此行将删除自动启动:

And this line will remove the autostart:

Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run").DeleteValue("keyNameForRegistry", false);

我相信这些应该有效.我现在没有时间测试它们.可能会有一些错别字.不要忘记添加,不确定是否两者都需要.

I believe these should work. I don''t have time to test them now. There might be some typos. Dont forget to add, not sure if the both are needed tho.

using Microsoft.Win32; using System.Reflection;

更多推荐

Windows启动时如何运行我的应用程序?

本文发布于:2023-11-05 08:29:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560368.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:启动时   应用程序   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!