c# killing explorer, and keeping it that way.
c# killing explorer, and keeping it that way.
I'm using the method below to kill explorer. But everytime i do so, it decides to boot back up automatically. How can i make explorer stay dead
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("explorer");
for(int i=0 ;i<p.GetLength(0);i++)
p
.Kill();
Thanks in advance.
c# killing explorer, and keeping it that way.
PhilAJ
Sure, if you're not running another shell, or if you want to access icons on the desktop/systray/etc... But if you're running a game A program to delete temp files that explorer is hooked into Nope. I'm not saying it doesn't have to run for windows to function like microsoft wants it to function, I'm just saying it doesn't always have to run.
SOTY_Programmer
Even running another shell only performs some of the tasks that Explorer performs. Explorer deals with servicing many of the shell apis, not something a Shell replacement does.
"...doesn't have to run for Windows to function like Microsoft wants it to function..." Yes, as in you want Windows to work... If you want Windows to work properly Explorer needs to run.
supersonic1976
u must be able to kill explorer and it is not need to run the program i 2 am attempting to kill explorer for a secruity reason if u kill explorer every think still runs in the background juz no1 can see it since the explorer aint working and i can make my program work after i kill explorer in taskmanger
see i have the idea that if i can kill taskmanger to which aint dat hard to block it from loading up i can have a total screen lock and no1 will be able 2 see wots on the pc even tho its runing in the background with out entering the password it would be good for internet cafes when the time is up if this program was set to every hour juz cut the pc out after times up and if they pay for longer enter thepassword and all there stuff is till there special since u can load explorer back up very easily
basic example
private void button1_Click(object sender, EventArgs e){
System.Diagnostics.
Process pr = new System.Diagnostics.Process(); string x; x = textBox1.Text; if (x == "password"){
pr.StartInfo.FileName = @"c:\WINDOWS\explorer.exe";pr.Start();Application.Exit();}
else{
MessageBox.Show("soz rong code ", "mkb main", MessageBoxButtons.OK, MessageBoxIcon.Error);}seems very easy way to do it and very safe way since u could juz block the ctrl key so taskman dnt open or even juz have a timer to see if it is open ever 300milisecs and if it is open close it so no way round it lot safer than the timers to see if u hit the rite key on the screen locks and also if u dnt close explorer u would have to block the control button block the window start key block alt button and even then there would probly be away to get round the screen lock
LiamD
kinpin9
Alexannic
Asking why someone wants to fiddle with OS program is like saying 640KB of memory is enough... The main reason I would want explorer to stay dead is because of all the files it hooks into that I might want to modify or delete (specifically, index.dat in the c:\windows\temporary internet files folder)
Explorer is a part of Windows, but not a required process, applications will chug along happily with explorer closed, or even running a different shell all together.
To keep explorer dead, first run this little bit of code
RegistryKey OurKey = Registry.LocalMachine;
OurKey = OurKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true);
OurKey.SetValue("AutoRestartShell", 0);
Exploder
In Windows XP (and maybe 2000) when Explorer.exe is terminated or, flakes for an error the OS reinstates it. As far as I can tell that is hard coded into the OS so I do not think there will be a way to kill it permanently. I do, however, beleive there is a way to change the application used in place of Explorer if you are attempting to do that. While I do not know how, I do know it is possible. Nonetheless the OS has to have some sort of shell running.
Quilnux
Gidjett
tyaramis
Read the last part of this article: http://www.codeproject.com/win32/AntonioWinLock.asp
Replace de userinit.exe, with your own "Myuserinit.exe", and try starting explorer.exe from your code there. When you kill it from the Task Manager it won't load up again since it was "manually" started i think.
The original userinit.exe that executes after your enter your user/password and Windows Login, starts explorer.exe among other things. I think it somehow keeps track of explorer.exe, in a thread or something and when explorer.exe is killed, it restarts it.
If you wan't to convince yourself, do this: Replace userinit.exe with your myuserinit.exe with the sort of code shown there. But, replace the define "#define NEWUSERINIT", with cmd.exe.
So when you login, you'll get a Command Prompt and now explorer.exe running. Then start explorer.exe from there and you'll get your system up normally. Then kill explorer.exe and it shouldn't start again.
I think (haven't tried yet), that instead of manually loading explorer.exe, you just execute it from code, the effect will be the same, and once killed it won't load back up.
Regards,
Alan //
RichardR