The following code makes use of the Shell32 .Shell class to minimize all open windows, similar to what the Show Desktop button on the taskbar does. This also hides all open dialogboxes.
namespace ShowDesktop{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private static Shell32.Shell shellInterface = new Shell32.Shell(); private void button1_Click(object sender, EventArgs e) { shellInterface.MinimizeAll(); } }}