袁承志去哪了:怎么用VB编关机程序,要源代码哦!!

来源:百度文库 编辑:高校问答 时间:2024/04/30 08:35:17
最好不要用API函数!
用没有VB自己提供的啊!!

使用ExitWindowsEx函数,函数有两个参数确定如何关闭Windows,其中第二个参数未使用
设置为0

Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Declare Function ExitWindowsEx Lib "user32" Alias _
"ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long

If you wanted to forcefully reboot the computer use the following code:
如果想强制重新启动计算机,函数应该这样使用:
t& = ExitWindowsEx(EWX_FORCE OR EWX_REBOOT, 0)

李杰,我也想知道!!!知道后,别忘记告诉我哟!!!