Hi Hamish,
if ( !( GetSystemMetrics(SM_CXFULLSCREEN) >= GetSystemMetrics(SM_CXSCREEN) && GetSystemMetrics(SM_CYFULLSCREEN) >= GetSystemMetrics(SM_CYSCREEN) ))
Why are you comparing two system metrics? Are they changing when a program goes fullscreen? I'm pretty sure they don't. Did you also test that it only hides the taskbar when it should? For me both SM_CXSCREEN and SM_CXFULLSCREEN are 1920 - that would hide the tray always, even in windowed mode.
Regards, Fabian Maurer