public enum ProcessType
{
ControlPanel,
MyComputer,
NetworkPlaces,
RecycleBin
}
private static string MyComputer = "::{20d04fe0-3aea-1069-a2d8-08002b30309d}";
private static string RecycleBin = "::{645FF040-5081-101B-9F08-00AA002F954E}";
private static string ControlPanel = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}";
private static string NetworkPlaces = "::{208D2C60-3AEA-1069-A2D7-08002B30309D}";
public static Process GetProcessByType(ProcessType type)
{
string argument = ReturnCommand(type);
Process p = new Process();
p.StartInfo = new ProcessStartInfo("Explorer.exe", argument);
return p;
}
private static string ReturnCommand(ProcessType type)
{
string command = String.Empty;
switch (type)
{
case ProcessType.ControlPanel:
command = ControlPanel;
break;
case ProcessType.MyComputer:
command = MyComputer;
break;
case ProcessType.NetworkPlaces:
command = NetworkPlaces;
break;
case ProcessType.RecycleBin:
command = RecycleBin;
break;
}
return command;
}
Then to call, you can call like this for a simple start:
button1_Click(object sender, EventArgs e)
{
GetProcessByType(ProcessType.MyComputer).Start();
}