本文介绍了系统启动时启动wpf应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
—SA
—SA
早上好 当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;
更多推荐
系统启动时启动wpf应用程序
发布评论