Suprising anyone got this to work because the parameters in findwindow are reversed and wrong. Should be
TrayHandle := FindWindow(nil, pchar('Shell_TrayWnd'));
and
PostMessage(TrayHandle,WM_CLOSE{ WM_EXITEXPLORER}, 0, 0);
works fine.