0

I have a button which currently runs explorer:-

private void _mJobsExplorer(object sender, RoutedEventArgs e)
{

            Process.Start(@"C:\");
}

I need to be able to launch the Desktop instead. Launching explorer that points to Desktop is not enough.

I have created a Desktop.scf, that launches the Desktop, but I don't know how to launch this within c# either.

I would prefer to launch Desktop straight from the code instead of calling a program that launches Desktop.

Any ideas?

DavidG
  • 113,891
  • 12
  • 217
  • 223
Ian Thompson
  • 187
  • 1
  • 11
  • 5
    What is "launch the desktop"? Do you actually mean "show the desktop"? – DavidG Mar 01 '17 at 11:14
  • Surely you can get the desktop path with `Environment.GetFolderPath(Environment.SpecialFolder.Desktop)` and use `Process.Start` to open that folder? Is that what you mean? – Equalsk Mar 01 '17 at 11:14
  • 2
    Do you mean, like... minimize all windows so you can see the desktop? If so, that'd probably be a clearer way to phrase this. – Joe Clay Mar 01 '17 at 11:14
  • Yes I want to minimise all windows to get to the desktop, like when you press show desktop on the taskbar. – Ian Thompson Mar 01 '17 at 11:19
  • 1
    A search on `show desktop programmatically c#` leads to [this blog post](https://blogs.msdn.microsoft.com/robgruen/2004/02/24/programmatically-showing-the-desktop-toggledesktop/) – Damien_The_Unbeliever Mar 01 '17 at 11:21
  • This worked for me with a slight tweak of removing the references to Class. Shell32.Shell objShel = new Shell32.Shell(); // Show the desktop ((Shell32.IShellDispatch4)objShel).ToggleDesktop(); – Ian Thompson Mar 01 '17 at 11:38
  • Do you really need to put this in your app? Just use `Windows+D` keyboard shortcut. – DavidG Mar 01 '17 at 11:39
  • The app hides the taskbar and Window+D does not work, hence the need to show the Desktop via a button. – Ian Thompson Mar 01 '17 at 11:45
  • Are you just wanting the app to run as the only thing visible on the machine, in other words, in kiosk mode? – DavidG Mar 01 '17 at 12:15

0 Answers0