System Delphi

function IsActiveDeskTopOn: Boolean;
var
h: hWnd;
begin
h := FindWindow('Progman', nil);
h := FindWindowEx(h, 0,
'SHELLDLL_DefView', nil);
h := FindWindowEx(h, 0,
'Internet Explorer_Server', nil);
Result := h <> 0;
end;