Share via


IShellDispatch.ShutdownWindows 方法

顯示 [ 關閉 Windows ] 對話方塊。 這與按一下 [ 開始 ] 功能表並選取 [ 關機] 相同。

語法

IShellDispatch.ShutdownWindows()

IShellDispatch.ShutdownWindows()

參數

這個方法沒有任何參數。

傳回值

JScript

這個方法不會傳回值。

VB

這個方法不會傳回值。

備註

此方法是透過 Shell.ShutdownWindows 方法實作和存取。

範例

下列範例示範在 JScript、VBScript 和 Visual Basic 中使用 ShutdownWindows

Jscript:

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

VBScript:

<script language="VBScript">
    function fnShellShutdownWindowsVB()
        dim objShell
        
        set objShell = CreateObject("shell.application")
        objshell.ShutdownWindows

        set objShell = nothing
    end function
 </script>

Visual Basic:

Private Sub fnShellShutdownWindowsVB()
    Dim objShell As Shell
    
    Set objShell = New Shell
    objshell.ShutdownWindows

    Set objShell = Nothing
End Sub

規格需求

需求
最低支援的用戶端
Windows 2000 專業版、Windows XP [僅限傳統型應用程式]
最低支援的伺服器
Windows 2000 Server [僅限傳統型應用程式]
標頭
Shldisp.h
Idl
Shldisp.idl
DLL
Shell32.dll (4.71 版或更新版本)