系统启动时启动wpf应用程序 [英] starting the wpf application when system starts

查看:75
本文介绍了系统启动时启动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事件并运行您的应用程序.

另一种方法是将您的应用程序添加到启动"下的开始"菜单中.您可以将其添加到所有用户"或单个用户帐户下.

用户尝试使用的方法应在用户登录时起作用: http://msdn.microsoft.com/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: http://msdn.microsoft.com/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应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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