0 out of 1 rated this helpful - Rate this topic

IShellDispatch4.ToggleDesktop method

Applies to: desktop apps only

Displays or hides the desktop.

Syntax

IShellDispatch4.ToggleDesktop()

Parameters

This method has no parameters.

Return value

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

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Shldisp.h

IDL

Shldisp.idl

DLL

Shell32.dll (version 6.0 or later)

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ