I would like to create a VB.net program that will prompt a user before it shows them their desktop for a password. If the password is correct it will log in. If incorrect, after a couple of tries the compuer will shut down. The only problem is starting the program without showing any icons or the taskbar. I haven't tried the startup folder in the start menu because wouldn't that show the desktop first? Also I would like it to load before the desktop loads (and then continue to load the desktop after logging in) so you can't close it with task manager or accidentally minimize the form (with the Windows Key + D).
Thank you.
P.S. I do not care about actual security it is just a way to see who's logging on. Also the people will be logging on to the same Windows account... it's faster than switching users.
(I am using Visual Studio 2010 Express.)
You could stop explorer.exe
from opening temporarily by replacing it with your start-up program in the registry:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
So you change Shell = Explorer.exe
to Shell = C:\path\to\Myapplication.exe
.
More details can be found on MSDN (article actually focuses XP Embedded but should work the same way in a regular installation).
What this does is, explorer.exe
loads the desktop and the taskbar. Windows launches the .exe
file that is in the registry value we edited and loads the desktop and taskbar. By replacing explorer.exe
with your program, it launches your program insted.
The desktop will load normally after your application launches explorer.exe
. (Thanks to Matt for confirming that works.) Process.Start("explorer.exe")
will launch explorer.exe
and load your desktop.
If you are not putting your application in the Windows directory or adding it to the Path variable, you need to fully qualify the location (write the full location like above).