招商银行月坛中心地点:谁知道VB关闭计算机的代码?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 04:59:34
如题~~~~~

关闭计算机。这可以调用Win32 API函数 ExitWindowsEx

下面首先来说明一下 ExitWindowsEx 函数,该函数在VB中的声明如下:

Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long

【返回值】
Long,非零表示成功,零表示失败。
【参数表】
uFlags --------- Long,
指定下述一个或多个标志(用OR运算符合并到一起)
EWX_FORCE=4
强迫中止没有响应的进程
EWX_LOGOFF=0
中止进程,然后注销
EWX_SHUTDOWN=1
关掉系统电源(如果可能的话,ATX电源就可以)
EWX_REBOOT=2 重新引导系统
dwReserved ----- Long,保留,设为零

Shell "c:\windows\system32\shutdown.exe -s -t 10"
10秒钟后关闭计算机