Blog

Windows 7: XP/Vista style "Show Desktop".

30 November 2009
You've probably just installed Windows 7, it's working wonderfully, but you're a little frustrated that your "Show Desktop" button is now on the far right.
You're probably using a laptop touchpad, another crazy input device, or you're just too adjusted to the old button positioning. :)

Ever heard of Windows Key + D?

I've stumbled upon a method to do this using a program which you can "pin to taskbar".

Download "ShowDesktop.exe".

If you're interested in the source code, click "Read More".

Download "ShowDesktop.cpp".


using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace ShowDesktop
{
	class Program
	{
		[DllImport("user32.dll",SetLastError = true)]
		static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
	
		static void Main(string[] args)
		{
			byte VK_D = 0x44;
			byte VK_Win = 0x5B;
			const int KEYEVENTF_KEYUP = 0x2;
			const int KEYEVENTF_KEYDOWN = 0x0;
			
			keybd_event(VK_Win, 0, KEYEVENTF_KEYDOWN, 0);//press win
			keybd_event(VK_D, 0, KEYEVENTF_KEYDOWN, 0);//press D
			keybd_event(VK_D, 0, KEYEVENTF_KEYUP, 0);//release D
			keybd_event(VK_Win, 0, KEYEVENTF_KEYUP, 0);//release win
		}
	}
}


Share:
Share on Facebook
Tags: