IShellDispatch4.ToggleDesktop method

Displays or hides the desktop.

Syntax

IShellDispatch4.ToggleDesktop()

IShellDispatch4.ToggleDesktop()

Parameters

This method has no parameters.

Return value

JScript

This method does not return a value.

VB

This method does not return a value.

Remarks

This method has the same effect as the Show Desktop button on the taskbar. It either hides all open windows to show the desktop or it hides the desktop by showing all open windows. The ToggleDesktop method does not display a user interface, it just invokes the toggle action.

Examples

The following examples show the proper use of ToggleDesktop for JScript, VBScript, and Visual Basic.

JScript:

<script language="JScript">
    function fnIShellDispatch4ToggleDesktopJ()
    {
        var objShell = new ActiveXObject("shell.application");
        
        objShell.ToggleDesktop();
    }
</script>

VBScript:

<script language="VBScript">
    function fnIShellDispatch4ToggleDesktopVB()
        dim objShell
        
        set objShell = CreateObject("shell.application")
            objShell.ToggleDesktop
        set objShell = nothing
    end function
 </script>

Visual Basic:

Private Sub fnIShellDispatch4ToggleDesktopVB()
    Dim objShell As Shell
            
    Set objShell = New Shell
        objShell.ToggleDesktop
    Set objShell = Nothing
End Sub

Requirements

Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 6.0 or later)