ID:40330
 
It's actually a pretty sloppy fix, but I blame it on my current BAC. This program periodically checks to see if explorer.exe is running, and if it isn't, the program restarts explorer.exe. For some reasons explorer likes to just give up on me 3-4 hours in, and i'm fairly sure my hardware is failing, but I digress.

The code is written in C#.

/*
* Created in SharpDevelop
* By Jeremy Anderson
*/


using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
using Microsoft.Win32;

namespace explorer_crash_fix{
/// <summary>
/// Binds itself to launch on startup, then detects for explorer.exe closed and restarts it if it is!
/// </summary>
public class crashCheck{

bool explorerOFF=false;
bool doCheckLoop=true;

public crashCheck(){

while(doCheckLoop==true){
Thread.Sleep(3000);
explorerOFF=true;
System.Diagnostics.Process[] runningProcesses = System.Diagnostics.Process.GetProcesses();
for(int i=0; i<runningProcesses.Length ; i++){
string processName = runningProcesses[i].ProcessName;
if(processName=="explorer"){
explorerOFF=false;
}
}
if(explorerOFF==true){
Process p=new Process();
p.StartInfo.FileName=@"C:\Windows\explorer.exe";
p.StartInfo.CreateNoWindow=true;
p.Start();

}

}
}
}

public class starter{
static void Main(){
crashCheck LOOKDICKS = new crashCheck();
}
}
}


I was too lazy to write a registry key addition function, so I just boud the program to system startup manually.
Cool Program, but usually myself I have Task Manager open and if Windows Explorer crashes I just start a new task. This would be a useful program for me because on those odd times where task manager is gone that could restore explorer.
Oooh cool you can program in c#

I has request for you.

get on msn plox <3
Upinflames wrote:
Cool Program, but usually myself I have Task Manager open and if Windows Explorer crashes I just start a new task. This would be a useful program for me because on those odd times where task manager is gone that could restore explorer.

Well for me anyways, when explorer crashes It won't display any windows such as task manager either, so this is the only solution for me.
Eww, C#.
Better than pointers.
Normally on the odd occasion I (or Windows) do(es) something stupid Explorer opens right back up after 30 seconds anyway. Then again, I'm using XP so I'm not sure if that behaviour still exists in Vista.
Hazman wrote:
Normally on the odd occasion I (or Windows) do(es) something stupid Explorer opens right back up after 30 seconds anyway. Then again, I'm using XP so I'm not sure if that behaviour still exists in Vista.

Well, it doesn't do that for me, so yeah :D