简体   繁体   English

Windows启动时的应用

[英]Application on windows startup

i wish to load my C# application after windows user login and before windows desktop appears. 我希望在Windows用户登录之后和Windows桌面出现之前加载C#应用程序。 currently i added my application startup path to registry run key. 目前,我已将我的应用程序启动路径添加到注册表运行键中。 it loads my application correctly but windows windows desktop appears[2 sec] then my application runs 它可以正确加载我的应用程序,但是出现Windows Windows桌面[2秒],然后我的应用程序运行

Note: 注意:

My application creates seperate desktop using winapi, while my application running it hides the desktop temporarily. 我的应用程序使用winapi创建单独的桌面,而我的应用程序运行时则暂时隐藏桌面。

This really isn't possible to do. 这确实是不可能的。 Windows works pretty hard to get the desktop up and explorer responsive as soon after the user logs in. This is what is most important to the user. 用户登录后,Windows会非常努力地启动桌面并启动资源管理器响应。这对用户而言最重要。

Your goals may be noble, but they are at odds with what users want. 您的目标可能很高,但与用户的需求不符。 So in general, they are at odds with how Windows works (especially Win-7). 因此,总的来说,它们与Windows的工作方式(特别是Win-7)不一致。

If you have software that needs to run early that doesn't need to interact with the user, then a service is they way to go. 如果您有需要及早运行且无需与用户交互的软件,那么他们便可以提供服务。 It is important to note that in Vista and later Windows systems, there is no way for a service to interact with the user - eg they cannot have their own graphical user interface. 重要的是要注意,在Vista和更高版本的Windows系统中,服务无法与用户交互-例如,他们不能拥有自己的图形用户界面。 Services with UI are inherently not secure. 具有UI的服务本质上是不安全的。

One way to partition your software is to put some things in a service, and have a think UI layer on top of it. 对软件进行分区的一种方法是将一些东西放入服务中,并在其之上具有一个Think UI层。 COM and Local RPC are good choices for communication between your service and your UI layer. COM和本地RPC是服务与UI层之间进行通信的不错选择。

Note that you will need to do work here to prevent your components from slowing down boot. 请注意,您将需要在此处进行操作,以防止组件减慢启动速度。 Poorly behaving applications are one of the biggest problems in the boot path. 表现不佳的应用程序是引导路径中的最大问题之一。 You can study this using the Windows Performance Toolkit 您可以使用Windows Performance Toolkit进行研究

It is kinda possible I think, but you are really in for a lot of extra work. 这是有点可能我想,但你真的在很多额外的工作。 What you could do is replace the Windows Shell with your own code, but at that point you become solely responsible for the UI that the user interacts with. 您可以做的是用自己的代码替换Windows Shell,但是到那时,您将独自负责与用户进行交互的UI。

If your code isn't 'just right', you may end up with an unusable Windows install, and I'm not sure your users are going to appreciate that much. 如果您的代码不是“正确的”,则可能会导致Windows安装无法使用,并且我不确定您的用户是否会对此表示赞赏。

Also note that there may be features that you normally intuitively expect to be available on a Windows machine that are part of the shell which you will not have access to anymore. 还要注意,您通常会凭直觉期望Windows机器上的某些功能是外壳的一部分,而您将无法再使用这些功能。 For details, try http://en.wikipedia.org/wiki/Windows_shell_replacement as a starting point. 有关详细信息,请尝试以http://en.wikipedia.org/wiki/Windows_shell_replacement作为起点。

Addendum : 附录
I have only the vaguest knowledge myself about what is actually involved technically to make this happen, but http://dustyant.com/articles/deeshell/ seems to be a decent explanation of the basics. 我对这个技术实际上真正涉及到的内容只有最模糊的了解,但是http://dustyant.com/articles/deeshell/似乎是对基础知识的恰当解释。 Again tho... here be dragons make sure you do this in a VM or something so that you don't end up stuffing your main Windows install. 再说一遍... 这里是龙,请确保您在VM或其他操作中执行此操作,以免最终导致您无法完成Windows的主要安装。

Just briefly what 'Shell Replacement' means: after you log in, windows starts an application called 'explorer' (not sure if this still holds for Vista / Win 7... I have a vague recollection it got a little more involved recently), which basically draws the desktop, the taskbar, etc. ... it is possible to tell Windows to start a different application instead of the default graphical shell. 简而言之,“ Shell Replacement”的含义是:登录后,Windows启动一个名为“ explorer”的应用程序(不知道它是否仍适用于Vista / Win 7 ...我有一个模糊的回忆,它最近涉及到更多一点) ,它基本上可以绘制桌面,任务栏等。...可以告诉Windows启动其他应用程序,而不是默认的图形外壳程序。 At that point you are in control of the main UI of Windows... which means that you are responsible for everything that Windows normally does in the shell ... gives you a lot of control and flexibility, and possibly lots of headaches. 那时,您就可以控制Windows的主要UI了……这意味着您要对Windows通常在外壳程序中所做的一切负责。这给了您很多控制和灵活性,并且可能让人头疼。

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

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