Forum posts for sidebar.exe

Executing commands from C# problem

I've made a little C# tool for monitoring sidebar.exe (as some know there's a strange memory leak in it, so this monitor restarts the sidebar.exe process when it reaches a limit...).

Before this I had a .bat file doing it and I was running it manually, and it worked fine. Now, I'm executing the cmd commands from C#, but the behavior is different: only 4 of the 7 gadgets appear again after 'start sidebar.exe'. It always happens with the program, and never when run manually.

What's the difference in running the commands as .bat or from the process? And can I fix this?

I also tried running the .bat itself from the process, same problem...

The commands are:

taskkill /im sidebar.exe /f

TIMEOUT /T 2 in .bat or System.Threading.Thread.Sleep(2000); in program

start sidebar.exe

Update: The code of what I tried:
Option 1 - run .bat: System.Diagnostics.Process.Start(@'C:....restart.bat');
Option 2 - run commands:
...
this.executeCmd('taskkill /im sidebar.exe /f');
System.Threading.Thread.Sleep(2000);
this.executeCmd('start sidebar.exe');
...

private void executeCmd(String command)
{
ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo('cmd', '/c ' + command);
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = psi;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
System.Console.Out.WriteLine(result);
}


Update:
I've been told it's some permissions/account/user issue, tried to solve it with no success, but I noticed that in Java this doesn't happen so I combined Java and C# for this tool (a java runnable called on startup, using a small exe which returns the usage of sidebar.exe) - works perfect. Still would appreciate an answer if anyone knows about this C# issue though.

View complete forum thread with replies

Other posts related to sidebar.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

Reliably detecting OS architecture in a Windows Desktop Gadget
Executing commands from C# problem
Windows 7 Gadgets - Windows 7 Logo Program Certification
gadgets: Need to uninstall a gadget programmatically through code in C#
Code Profiling in the Windows Sidebar Environment
Running MSI installers silently

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.