i wish to load my C# application after windows user login and before windows desktop appears. 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


My application creates seperate desktop using winapi, while my application running it hides the desktop temporarily.

No correct solution


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.

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).

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 - e.g. they cannot have their own graphical user interface. Services with UI are inherently not secure.

One way to partition your software is to put some things in a service, and have a think UI layer on top of it. COM and Local RPC are good choices for communication between your service and your UI layer.

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

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.

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.

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. For details, try as a starting point.

I have only the vaguest knowledge myself about what is actually involved technically to make this happen, but seems to be a decent explanation of the basics. 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.

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. 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow