title: Get handle to desktop / shell window
body: <p>In one of my programs I need to test if the user is currently focusing the desktop/shell window. Currently I'm using GetShellWindow() from user32.dll and compare the result to GetForegroundWindow().</p>
  
  <p>This approach is working until someone changes the desktop wallpaper, but as soon as the wallpaper is changed the handle from GetShellWindow() doesn't match the one from GetForegroundWindow() anymore and I don't quite get why that is. (<strong>OS:</strong> Windows 7 32bit)</p>
  
  <p>Is there a better approach to check if the desktop is focused? Preferably one that won't be broken if the user changes the wallpaper?</p>
  
  <p><strong>EDIT:</strong> I designed a workaround: I'm testing the handle to have a child of class "SHELLDLL_DefView". If it has, the desktop is on focus. Whilst it's working at my PC that doesn't mean it will work all the time…</p>