系统启动时启动wpf应用程序

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

早上好 当Windows启动时,我无法启动我的wpf应用程序,我在Windows应用程序中做了同样的事情,但是在Wpf应用程序中却无法正常工作 我在常规应用程序中使用的示例代码,经过了注册表项的注册 但是此过程不适用于wpf应用程序

hi good morning i not able to start my wpf application when the windows Starts, ihad done same thing in windows application ,but it was not workink in the Wpf application the sample code which i was used in the normal application, i had went trhrought the registrying the key but this process is not working for the wpf application

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

请尝试说明一次,

please try to explain once ,

推荐答案

有很多方法. 首先,非常强大的方法是Windows服务的创建和注册.它可以捕获一些Windows事件并运行您的应用程序. 另一种方法是将您的应用程序添加到启动"下的开始"菜单中.您可以将其添加到所有用户"或单个用户帐户下. 用户尝试使用的方法应在用户登录时起作用: msdn.microsoft/en-us/library/aa376977(v=vs.85).aspx [ ^ ]. 检查您的注册.您实际在哪里写信?为什么使用这种奇怪的位置计算方法?您需要使用 There is a number of ways. First, very powerful method is creation and registration of the Windows Service. It can capture some Windows events and run your application. Another method is adding your application to Start menu under "Startup". You can add it under "All users" or individual user accounts. The method you''re trying to use should work when a user logs on: msdn.microsoft/en-us/library/aa376977(v=vs.85).aspx[^]. Check up your register. Where do you actually write to it? Why do you use such a strange way of calculation of the location? You need to use string applicationLocation = System.Reflection.Assembly.GetEntryAssembly().Location;

—SA

—SA

更多推荐

系统启动时启动wpf应用程序

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

发布评论

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

>www.elefans.com

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