I had a seemingly bright idea for a cleaner and easier to use operating system feature, for when the Windows clutter just gets too bad.

Basically I want to alter the behavior of every window, such that when it loses focus it is minimized. But I don't know how to do it yet!

Basically so far I plan to:

1. Store a handle to the window in focus (foreground I think it would be).
2. When the window loses focus, send a minimize event.

This is what I have so far.

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
	WINDOWPLACEMENT wndPlace; memset(&wndPlace, 0, sizeof(WINDOWPLACEMENT));
	wndPlace.length = sizeof(WINDOWPLACEMENT);
	HWND previousWindow = GetForegroundWindow();
	HWND newWindow;
	while( !GetAsyncKeyState(VK_ESCAPE) )
		newWindow = GetForegroundWindow();
		if((previousWindow != newWindow) && (newWindow != NULL))
			if( wndPlace.showCmd == SW_SHOWMAXIMIZED || wndPlace.showCmd == SW_SHOWNORMAL )
				previousWindow = newWindow;
	return 0;

But on Windows 7 there is a "window" that gets minimized that shouldn't be. It messes up my start menu actually, this is my start menu (you can drag it around the screen). Lots of weird behavior with hiding windows that belong to Windows.

What should I do? The behavior is quite nice thus far (minus the bugs). I am considering trying to determine if the windows belong to the OS by the path to their .exe...