开发者

Application Start Before Windows Explorer

Some inst开发者_StackOverflow社区allation applications stop (or appear to stop) the normal windows booting. The computer starts, the user logs in and then the installation program starts before others (like Windows explorer).

How can I replicate this behaviour in my own program?

E.g.

  • OS Boot
  • Login
  • The program runs, updates etc.
  • The rest of the programs run (e.g. windows explorer and what ever runs on startup)


If you want to start an application before the shell starts, you can add a value to the Userinit value in the registry. In this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

There is a value named Userinit. Change it so your program is run before userinit.exe. For example, to start notepad before the shell/everything else is initialized:

C:\WINDOWS\system32\notepad.exe,C:\Windows\system32\userinit.exe

Use commas to separate the programs that should be started.

This works for Windows XP, Vista, and 7.


I have not tried it but I assume that this is done by the registry entry

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup

There are even more registry keys - see the complete list documented here: Definition of the RunOnce Keys in the Registry

But for your use case I would recommend to start your application as desktop shell similar to the proposed solution by "vcsjones". When your program has finished you can call explorer.exe to start loading the regular desktop.


You could possibly wrap a windows batch file .bat around explorer.exe

@echo off
something.exe
explorer.exe

But that wouldn't really make sure it's always started before explorer.exe

You could possibly change some registry value to select another 'shell' instead of explorer for that . .

If that is what you are actually looking for.


You should have a look at Windows Task Scheduler. Tasks can be scheduled to execute when a user (specific or any) logs on. The UI provided out-of-the-box by Windows illustrates what can actually be done with this standard Windows feature.

Another solution is to write a Windows service (the .msi Windows Installer is in fact a service).

I'm not sure you will be able to block Windows Explorer though...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜