My Windows 7 (ASUS Eee) and Windows 8 (ASUS X502C!) PCs both have helper apps running on the desktop, so they're what get focus if nothing else is about and I haven't click on the actual desktop. ("Eee Docking" in the first instance; Asus Instant on Config in the latter.)
But when I kill the helper apps it's the Systray (class "Shell_TrayWnd") that gets focus in the Windows 8 case (I haven't installed the optional Start button) but the "Start" button (class "Button) for Windows 7.
PS Basic program I used to monitor what was going on.
Thanks Andy. I used your program and it came in handy; it turns out the start button wasn't the culprit. I'll be able to do what I need by checking when the foreground hwnd's classname is "WorkerW" - the Windows 7 version of progman (program manager for the shell). I guess the taskbar/start button are child classes of the program manager.. I'm going to download Spy++ to see what's going on here.
Edit: have you got wallpaper enabled on your PC? If so, see linked stackoverflow.com post for more info.
When there is set the wallpaper mode to slideshow, you have to search for a window of class WorkerW and check the children, whether there is a SHELLDLL_DefView. If there is no slideshow, you can use the good old GetShellWindow().